var url = "http://www.9f502.com";
var server = {
    is_login: url + "/api/is_login",  //授权登录
    login_wx: url + "/api/login_wx",  //授权登录

    users_info: url + "/api/users/users_info",  //个人信息

    // 上传图片
    uploadImg: url + "/api/oss/upload",

    goods_list: url + "/api/goods/goods_list",  //商品列表
    goods_return: url + "/api/goods/goods_return",  //返佣号卡列表
    details: url + "/api/goods/details",  //商品详情

    extension_link: url + "/api/extension_link",  //获取商品短连接

    get_all_link: url + "/api/get_all_link",  //获取推广汇总产品

    users_cash_edit: url + "/api/users/users_cash_edit",  //提现页面
    users_cash_save: url + "/api/users/users_cash_save",  //提现操作
    users_cash: url + "/api/users/users_cash",            //提现记录

    //订单
    earn_list: url + "/api/detail/earn_list",               //收益明细
    recommend_list: url + "/api/detail/recommend_list",     //推广明细

    query: url + "/api/query",     //订单查询

    users_auth_save: url + "/api/users/users_auth_save",     //平台实名认证操作


    get_order_info: url + "/api/goods/get_order_info",     //创建订单时获取信息接口
    phone_ownership: url + "/api/phone_ownership",         //归属地
    phone: url + "/api/phone",                             //获取手机号
    create_order: url + "/api/create_order",               //创建订单
    card_discern: url + "/api/card_discern",               //认证接口


    get_agreement: url + "/api/get_agreement",               //获取协议
};


// var accontdata = window.sessionStorage.getItem("account"); 


var addresstype = window.sessionStorage.getItem("addresstype");
var shopmailbuy = window.sessionStorage.getItem("shopmailbuy");
var goodsbuyid = window.sessionStorage.getItem("goodsbuyid");
var shopmailbuytype = window.sessionStorage.getItem("shopmailbuytype");
// if(!accontdata || !tokendata){
//     $('.language').html('<a href="./login.html">登录</a><a href="./regist.html">注册</a>');
// }else {
//     $('.language').html('<a href="./myCenterIndex.html"><img src="./images/forUser.png" width="16" height="13" />会员中心</a><a onclick="Signout()"><img src="./images/helpCenter.png" width="14" height="15" />退出</a>');
// }
function yanzhenma(window, document){
    var size = 4;//设置验证码长度
    function GVerify(options) { //创建一个图形验证码对象，接收options对象为参数
        this.options = { //默认options参数值
            id: "", //容器Id
            canvasId: "verifyCanvas", //canvas的ID
            width: "100", //默认canvas宽度
            height: "30", //默认canvas高度
            type: "blend", //图形验证码默认类型blend:数字字母混合类型、number:纯数字、letter:纯字母
            code: "",
        }
        if(Object.prototype.toString.call(options) == "[object Object]"){//判断传入参数类型
            for(var i in options) { //根据传入的参数，修改默认参数值
                this.options[i] = options[i];
            }
        }else{
            this.options.id = options;
        }
        
        this.options.numArr = "0,1,2,3,4,5,6,7,8,9".split(",");
        this.options.letterArr = getAllLetter();

        this._init();
        this.refresh();
    }
    GVerify.prototype = {
        /**版本号**/
        version: '1.0.0',
        
        /**初始化方法**/
        _init: function() {
            var con = document.getElementById(this.options.id);
            var canvas = document.createElement("canvas");
            this.options.width = con.offsetWidth > 0 ? con.offsetWidth : "100";
            this.options.height = con.offsetHeight > 0 ? con.offsetHeight : "30";
            canvas.id = this.options.canvasId;
            canvas.width = this.options.width;
            canvas.height = this.options.height;
            canvas.style.cursor = "pointer";
            canvas.innerHTML = "您的浏览器版本不支持canvas";
            con.appendChild(canvas);
            var parent = this;
            canvas.onclick = function(){
                parent.refresh();
            }
        },
        
        /**生成验证码**/
        refresh: function() {
            this.options.code = "";
            var canvas = document.getElementById(this.options.canvasId);
            if(canvas.getContext) {
                var ctx = canvas.getContext('2d');
            }else{
                return;
            }
            
            ctx.textBaseline = "middle";

            ctx.fillStyle = randomColor(180, 240);
            ctx.fillRect(0, 0, this.options.width, this.options.height);

            if(this.options.type == "blend") { //判断验证码类型
                var txtArr = this.options.numArr.concat(this.options.letterArr);
            } else if(this.options.type == "number") {
                var txtArr = this.options.numArr;
            } else {
                var txtArr = this.options.letterArr;
            }

            for(var i = 1; i <=size; i++) {
                var txt = txtArr[randomNum(0, txtArr.length)];
                this.options.code += txt;
                ctx.font = randomNum(this.options.height, this.options.height) + 'px SimHei'; //随机生成字体大小
                ctx.fillStyle = randomColor(50, 160); //随机生成字体颜色        
                ctx.shadowOffsetX = randomNum(-3, 3);
                ctx.shadowOffsetY = randomNum(-3, 3);
                ctx.shadowBlur = randomNum(-3, 3);
                ctx.shadowColor = "rgba(0, 0, 0, 0.3)";
                var x = this.options.width / (size+1) * i;
                var y = this.options.height / 2;
                var deg = randomNum(-30, 30);
                /**设置旋转角度和坐标原点**/
                ctx.translate(x, y);
                ctx.rotate(deg * Math.PI / 180);
                ctx.fillText(txt, 0, 0);
                /**恢复旋转角度和坐标原点**/
                ctx.rotate(-deg * Math.PI / 180);
                ctx.translate(-x, -y);
            }
            /**绘制干扰线**/
            for(var i = 0; i < 4; i++) {
                ctx.strokeStyle = randomColor(40, 180);
                ctx.beginPath();
                ctx.moveTo(randomNum(0, this.options.width), randomNum(0, this.options.height));
                ctx.lineTo(randomNum(0, this.options.width), randomNum(0, this.options.height));
                ctx.stroke();
            }
            /**绘制干扰点**/
            for(var i = 0; i < this.options.width/4; i++) {
                ctx.fillStyle = randomColor(0, 255);
                ctx.beginPath();
                ctx.arc(randomNum(0, this.options.width), randomNum(0, this.options.height), 1, 0, 2 * Math.PI);
                ctx.fill();
            }
        },
        
        /**验证验证码**/
        validate: function(code){
            var code = code.toLowerCase();
            var v_code = this.options.code.toLowerCase();
            if(code == v_code){
                return true;
            }else{
                this.refresh();
                return false;
            }
        }
    }
    /**生成字母数组**/
    function getAllLetter() {
        var letterStr = "a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z";
        return letterStr.split(",");
    }
    /**生成一个随机数**/
    function randomNum(min, max) {
        return Math.floor(Math.random() * (max - min) + min);
    }
    /**生成一个随机色**/
    function randomColor(min, max) {
        var r = randomNum(min, max);
        var g = randomNum(min, max);
        var b = randomNum(min, max);
        return "rgb(" + r + "," + g + "," + b + ")";
    }
    window.GVerify = GVerify;
}
function Signout(){
    // layer.confirm('确定要退出登录？', {icon: 3, title:'提示'}, function(index){
    //     layer.close(index);
    //     ajaxEve('post', serverhost.user_out, {account:accontdata}, function (result) {
    //         if (result.status == 200) {
    //             layer.msg("退出登录成功！", {icon: 6});
    //             window.sessionStorage.clear();
    //             window.setTimeout(function(){
    //                 window.location.href = "login.html";
    //             },2000);
    //         }else {
    //             layer.msg(result.msg, {icon: 5});
    //         }
    //     }, function (result) {
    //         layer.msg(result.msg, {icon: 5});
    //         return;
    //     });
    // });
};
function loginState(){
	if(!accontdata || !tokendata){
        layer.open({
            content: '您还没有登录！请先去登录',skin: 'msg',time: 2
        });
        window.sessionStorage.clear();
        window.sessionStorage.clear();
        layer.open({
            content: '您还没有登录！请先去登录',skin: 'msg',time: 2
        });
        // window.sessionStorage.clear();
        window.setTimeout(function(){
            window.location.href = "signin.html";
        },2000);
        return false;
	}else {
		return true;
	}	
};

//微信授权
var ua = navigator.userAgent.toLowerCase();
var isWeixin = ua.indexOf('micromessenger') != -1;
if (!isWeixin) {
    window.location.href = 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxc31bdf2ce95010be&redirect_uri=http://www.9f502.com/h5?first_uid=&response_type=code&scope=snsapi_userinfo&state=1&connect_redirect=1#wechat_redirect'
}

// ajax函数封装
function ajaxEve(type, url, data, sfun, efun) {
    var tokendata = window.sessionStorage.getItem("token");
    var accountdata = window.sessionStorage.getItem("account");
    $.ajax({
        url: url,
        type: type,
        contentType: "application/x-www-form-urlencoded",
        data: data,
        async: true,
        dataType: 'json',
        beforeSend: function(request) {
            request.setRequestHeader("token",tokendata);
            request.setRequestHeader("account",accountdata);
        },
        success: function (result) {
            layer.closeAll();
            if (result.status == 200) {
                sfun(result);
            }else if (result.status == 199) {
                sfun(result);

            }else if (result.status == 201) {
                sfun(result);

            }else if (result.code == 201) {
                sfun(result);

            }else if (result.status == 2010) {
                sfun(result);

            }
            else if (result.status == 404) {
                layer.open({
                    content: result.msg,skin: 'msg',time: 2
                });
                window.sessionStorage.clear();
                window.setTimeout(function(){
                    window.location.href = "signin.html";
                },2000);
            }else{
                if (efun) {
                    layer.closeAll();
                    efun(result);
                } else {
                    layer.open({
                        content: result.msg,skin: 'msg',time: 2
                    });
                }
                return;
            }
        },
        error: function (result) {
            console.log("AJAX ERROR", result);
        }
    })
};

// ajax使用
// ajaxEve('post', serverhost.firstindex, {}, function (result) {
//     if (result.data == null) {
//         layer.msg('数据请求为空！');
//         return;
//     } else if (result.code == 0) {
//         layer.msg(result.msg);
//         dataFun();
//     }
// }, function (result) {
//     layer.msg(result.msg);
//     return;
// });


var jo={};
(function(_) {
   var _uid=0;
    _.uid= function () {
        return ++_uid
    }

    _.escape = function(string) {
        return (''+string).replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;').replace(/'/g, '&#x27;').replace(/\//g,'&#x2F;');
    };
    var txnd = {};
    _._textNode = function(pid, s) {
        if (!(pid in txnd))
            txnd[pid] = [];
        txnd[pid].push(s);
        s= '<abbr id="jo_txnd'+txnd[pid].length+'">joO txnd</abbr>';
        return s;
    };
    _.template_end = function(pid) {
        var ps = txnd[pid], abbr;
        if (!ps || !ps.length) return;
        for (var i=1,l=ps.length; i<=l; i++) {
            abbr = _.G('jo_txnd'+i);
            abbr.parentNode.replaceChild(
                document.createTextNode(ps[i-1]), abbr );
        }
        abbr = ps = null;
        delete txnd[pid];
    };

    _.templateSettings = {
        evaluate    : /{%([\s\S]+?)%}/g,
        interpolate : /{%=([\s\S]+?)%}/g,
        escape      : /{%-([\s\S]+?)%}/g
    };

    _.template = function(str) {
        var pid = this.uid();
        var c  = _.templateSettings;
        var tmpl = 'var __p=[],print=function(){__p.push.apply(__p,arguments);};' +
            'with(obj||{}){__p.push(\'' +
            str.replace(/\\/g, '\\\\')
                .replace(/'/g, "\\'")
                .replace(c.escape, function(match, code) {
                    return "',jo._textNode("+pid+"," + code.replace(/\\'/g, "'") + "),'";
                })
                .replace(c.interpolate, function(match, code) {
                    return "'," + code.replace(/\\'/g, "'") + ",'";
                })
                .replace(c.evaluate || null, function(match, code) {
                    return "');" + code.replace(/\\'/g, "'")
                        .replace(/[\r\n\t]/g, ' ') + "__p.push('";
                })
                .replace(/\r/g, '\\r')
                .replace(/\n/g, '\\n')
                .replace(/\t/g, '\\t')
            + "');}return __p.join('');";
        var func = new Function('obj', tmpl);
        return [func, pid];
    };
    _.txnd = txnd;  // 反正也不打算长久用，先暴露出来吧，方便调试
})(jo);
jo.taTpl = function(taSel, data, posSel) {
    if (!data) return;
    var html = taSel.html();
    html = jo.template(html)[0](data); // null 值会被 join 干掉

    if (posSel) {
        taSel.remove();
        taSel = posSel;
    }
    taSel.replaceWith(html);
};

jo.reTpl = function(taSel, data, posSel) {
    if (!data) return;
    var html = taSel.html();
    html = jo.template(html)[0](data);
    posSel.empty().append(html);
};


// url截取
function GetQueryString(name){
	var reg = new RegExp("(^|&|)" + name + "=([^&?]*)(&|$|)", "i");  
    var r = window.location.search.substr(1).match(reg);  //获取url中"?"符后的字符串并正则匹配
    var context = "";  
    if (r != null)  
        context = r[2];  
        reg = null;  
        r = null;  
        return context == null || context == "" || context == "undefined" ? "" : context;   
}


// 日期格式yyyy-MM-dd HH-mm-ss
function formatDateTime(inputTime) {
    if(!isNaN(inputTime)){
        inputTime = inputTime.toString();
    };
    if(inputTime.length < 13){
        inputTime = Number(inputTime) * 1000;
    };
    var date = new Date(inputTime);
    var y = date.getFullYear();  
    var m = date.getMonth() + 1;  
    m = m < 10 ? ('0' + m) : m;  
    var d = date.getDate();  
    d = d < 10 ? ('0' + d) : d;  
    var h = date.getHours();
    h = h < 10 ? ('0' + h) : h;
    var minute = date.getMinutes();
    var second = date.getSeconds();
    minute = minute < 10 ? ('0' + minute) : minute;  
    second = second < 10 ? ('0' + second) : second; 
    return y + '-' + m + '-' + d+' '+h+':'+minute+':'+second;  
};

// 日期格式yyyy-MM-dd
function formatDateTime1(inputTime) {
    if(!isNaN(inputTime)){
        inputTime = inputTime.toString();
    };
    if(inputTime.length < 13){
        inputTime = Number(inputTime) * 1000;
    };
    var date = new Date(inputTime);
    var y = date.getFullYear();  
    var m = date.getMonth() + 1;  
    m = m < 10 ? ('0' + m) : m;  
    var d = date.getDate();  
    d = d < 10 ? ('0' + d) : d;  
    return y + '-' + m + '-' + d; 
};
// 日期格式HH-mm-ss
function formatDateTime2(inputTime) {
    if(!isNaN(inputTime)){
        inputTime = inputTime.toString();
    };
    if(inputTime.length < 13){
        inputTime = Number(inputTime) * 1000;
    };
    var date = new Date(inputTime);
    var h = date.getHours();
    h = h < 10 ? ('0' + h) : h;
    var minute = date.getMinutes();
    var second = date.getSeconds();
    minute = minute < 10 ? ('0' + minute) : minute;  
    second = second < 10 ? ('0' + second) : second; 
    return h+':'+minute+':'+second; 
};
// 日期格式HH-mm-ss
function formatDateTime3(inputTime) {
    if(!isNaN(inputTime)){
        inputTime = inputTime.toString();
    };
    if(inputTime.length < 13){
        inputTime = Number(inputTime) * 1000;
    };
    var date = new Date(inputTime); 
    var m = date.getMonth() + 1;  
    m = m < 10 ? ('0' + m) : m;  
    var d = date.getDate();  
    d = d < 10 ? ('0' + d) : d;  
    return m + '-' + d; 
};
function formatDateTime4(inputTime){
    var day = parseInt(inputTime/86400);
    var hour = parseInt(inputTime%86400/3600);
    hour = hour < 10 ? ('0' + hour) : hour;
    var minute = parseInt(inputTime%86400%3600/60);
    minute = minute < 10 ? ('0' + minute) : minute;
    var second = parseInt(inputTime%86400%3600%60);
    second = second < 10 ? ('0' + second) : second;
    if(day == 0){
        return hour + ":" + minute + ":" + second;
    }else {
        return day + "天 " + hour + ":" + minute + ":" + second;
    }
}

function formatDateTime5(){
    var date = new Date(date);
    var seperator1 = "-";
    var year = date.getFullYear();
    var month = date.getMonth() + 1;
    var strDate = date.getDate();
    if (month >= 1 && month <= 9) {
        month = "0" + month;
    }
    if (strDate >= 0 && strDate <= 9) {
        strDate = "0" + strDate;
    }
    var currentdate = year + seperator1 + month + seperator1 + strDate;
    return currentdate;
}

//特殊符号转移
function escapeHtml(str) {
    return str
        .replace(/&amp;/g, "&")
        .replace(/&lt;/g, "<")
        .replace(/&gt;/g, ">")
        .replace(/&quot;/g, '"')
        .replace(/&#039;/g, "'");
}

function GetQueryString(name){
    var reg = new RegExp("(^|&|)" + name + "=([^&?]*)(&|$|)", "i");  
    var r = window.location.search.substr(1).match(reg);  //获取url中"?"符后的字符串并正则匹配
    var context = "";  
    if (r != null)  
        context = r[2];  
        reg = null;  
        r = null;  
        return context == null || context == "" || context == "undefined" ? "" : context;   
}

function cutZero(old){
    //拷贝一份 返回去掉零的新串
    newstr=old;
    //循环变量 小数部分长度
    var leng = old.length-old.indexOf(".")-1
    //判断是否有效数
    if(old.indexOf(".")>-1){
        //循环小数部分
        for(i=leng;i>0;i--){
            //如果newstr末尾有0
            if(newstr.lastIndexOf("0")>-1 && newstr.substr(newstr.length-1,1)==0){
                var k = newstr.lastIndexOf("0");
                //如果小数点后只有一个0 去掉小数点
                if(newstr.charAt(k-1)=="."){
                    return  newstr.substring(0,k-1);
                }else{
                //否则 去掉一个0
                    newstr=newstr.substring(0,k);
                }
            }else{
            //如果末尾没有0
                return newstr;
            }
        }
    }
 return old;
}
var countdowntype = true;//倒计时状态
function networking(){
    this.agreementtype = false;
    this.informationtype =false;
}

// 获取用户信息
networking.prototype.getNewUserInfo = function(){
    let _this = this;
    ajaxEve('post', server.user_info, {}, function (result) {
        if (result.status == 200) {
            _this.userinfo = result.data;
        };
    }, function (result) {
        return;
    });
};

//获取滚动条当前的位置
networking.prototype.getScrollTop= function(){
        var scrollTop = 0;
        if(document.documentElement && document.documentElement.scrollTop) {
            scrollTop = document.documentElement.scrollTop;
        } else if(document.body) {
            scrollTop = document.body.scrollTop;
        }
        return scrollTop;
};
//获取当前可视范围的高度
networking.prototype.getClientHeight= function(){
    var clientHeight = 0;
    if(document.body.clientHeight && document.documentElement.clientHeight) {
        clientHeight = Math.min(document.body.clientHeight, document.documentElement.clientHeight);
    } else {
        clientHeight = Math.max(document.body.clientHeight, document.documentElement.clientHeight);
    }
    return clientHeight;
};
//获取文档完整的高度
networking.prototype.getScrollHeight= function(){
    return Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
};


// 加法
networking.prototype.Addition = function(a, b) {
    var a = a == '' ? 0 : a;
    var b = b == '' ? 0 : b;
    if(!isNaN(a)){
        a = String(a);
    };
    if(!isNaN(b)){
        b = String(b);
    };
    var c, d, e;
    try {
        c = a.toString().split(".")[1].length;
    } catch(f) {
        c = 0;
    }
    try {
        d = b.toString().split(".")[1].length;
    } catch(f) {
        d = 0;
    }
    return e = Math.pow(10, Math.max(c, d)), (mul(a, e) + mul(b, e)) / e;
};


// 减法
networking.prototype.Subtraction = function(a, b) {
    var a = a == '' ? 0 : a;
    var b = b == '' ? 0 : b;
    if(!isNaN(a)){
        a = String(a);
    };
    if(!isNaN(b)){
        b = String(b);
    };
    var c, d, e;
    try {
        c = a.toString().split(".")[1].length;
    } catch(f) {
        c = 0;
    }
    try {
        d = b.toString().split(".")[1].length;
    } catch(f) {
        d = 0;
    }
    return e = Math.pow(10, Math.max(c, d)), (mul(a, e) - mul(b, e)) / e;
};
// 乘法
networking.prototype.Multiplication = function(arg1, arg2) {
    if(arg1 && arg2){
        var arg1 = arg1 == '' ? 0 : arg1;
        var arg2 = arg2 == '' ? 0 : arg2;
        if(!isNaN(arg1)){
            arg1 = String(arg1);
        };
        if(!isNaN(arg2)){
            arg2 = String(arg2);
        };
        var r1, r2, m, n, q;
        if(parseInt(arg1) == arg1) {
            r1 = 0;
        } else {
            r1 = arg1.toString().split(".")[1].length;
        }
        if(parseInt(arg2) == arg2) {
            r2 = 0;
        } else {
            r2 = arg2.toString().split(".")[1].length;
        }
        m = Math.pow(10, r1);
        n = Math.pow(10, r2);
        q = m * n;
        var sum = (((arg1 * m) * (arg2 * n)) / q);
        return sum;
    }
};
function mul(a, b) {
    var c = 0,
        d = a.toString(),
        e = b.toString();
    try {
        c += d.split(".")[1].length;
    } catch (f) {}
    try {
        c += e.split(".")[1].length;
    } catch (f) {}
    return Number(d.replace(".", "")) * Number(e.replace(".", "")) / Math.pow(10, c);
}
//上传图片






// 手机正则
networking.prototype.checkMobile = function(sMobile) {
    var phone = $.trim(sMobile);
    var reg = /^1\d{10}$/;
    return reg.test(phone); 
};
//身份证号验证
networking.prototype.isCardNo = function(card) {
    // 身份证号码为15位或者18位，15位时全为数字，18位前17位为数字，最后一位是校验位，可能为数字或字符X
    var idNumber = $.trim(card);
    var reg =/(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;
    return reg.test(idNumber);
};

networking.prototype.UserLogin = function(sMobile) { //用户名验证
    var phone = $.trim(sMobile);
    var reg1 = /.*[\u4e00-\u9fa5]+.*$/;
    var reg2 = /\d+/;
    var pattern = new RegExp("[`~!@#$^&*()=|{}':;',\\[\\].<>《》/?~！@#￥……&*（）——|{}【】‘；：”“'。，、？]");
    var pattern2 = /[a-zA-Z]/;
    return reg1.test(phone)&&reg2.test(phone)&&!pattern.test(phone)&&!pattern2.test(phone); 
};
networking.prototype.Password = function(val) {//密码格式
    var reg = /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{8,12}$/
    return reg.test(val);
};
networking.prototype.Return = function(){ //返回按钮
    $(".iconReturn").on('click', function() {
        history.go(-1);
    })
};
networking.prototype.Numberonly = function(val){ //数字验证
    var reg = /^[0-9]*$/;
    return reg.test(val);
};

networking.prototype.tabChange = function(ele,eleContent,activeClass,_this){
    ele.removeClass(activeClass);
    _this.addClass(activeClass);
    let clikIndex = _this.index();
    eleContent.hide();
    eleContent.eq(clikIndex).show();
};
networking.prototype.Clickselection = function(){
    _this = this;
   $('.protocol .one').on('click',function(){
        _this.agreementclass = $(this);
        if(_this.agreementtype){
            _this.agreementtype = false;
            _this.agreementclass.children("i").attr('class',"Unchecked");
        }else {
            _this.agreementtype = true;
            _this.agreementclass.children("i").attr('class',"Selection");
        }   
   });
   // $('.protocol .two').on('click',function(){
   //      _this.informationclass = $(this);
   //      if(_this.informationtype){
   //          _this.informationtype = false;
   //          _this.informationclass.children("i").attr('class',"Unchecked");
   //      }else {
   //          _this.informationtype = true;
   //          _this.informationclass.children("i").attr('class',"Selection");
   //      }   
   // })
};


// let _this = $(this);
//clw.tabChange(clw.mainHeaderArr,clw.mainContentArr,'header_active',_this);
var clw = new networking();


networking.prototype.register = function (argument) {
	var _this = this;
	_this.Return();
	_this.Clickselection();
	document.getElementsByClassName("VerificationCode")[0].onclick = function(){
		_this.mobile = document.getElementsByName('mobile')[0].value;
		if(countdowntype){
			countdowntype = false;
		}else {
			return false;
		};
		if (!_this.mobile) {
			layer.open({
			    content: '手机号不能为空！',skin: 'msg',time: 2 
			});
			countdowntype = true;
			return false;
		};
		if (!_this.checkMobile(_this.mobile)) {
			layer.open({
			    content: '手机号格式有误！',skin: 'msg',time: 2 
			});
			countdowntype = true;
			return false;
		};
		layer.open({type: 2 ,shadeClose:false});
		$.get(server.send_sms,{'mobile':_this.mobile,'type':'1'},function(response){
			layer.closeAll();
			if(response.status == '200'){
				layer.open({
				    content: '短信验证码已发送到手机请注意查收',skin: 'msg',time: 2 
				});
				_this.mobile1 = _this.mobile;
				countdown();
			}else {
				countdowntype = true;
				layer.open({
				    content: response.msg,skin: 'msg',time: 2 
				});
			};
		});
	};
	document.getElementsByClassName("but")[0].onclick = function(){
		_this.userlogin = document.getElementsByName('userlogin')[0].value;
		_this.mobile = document.getElementsByName('mobile')[0].value;
		_this.code = document.getElementsByName('code')[0].value;
		_this.opwd = document.getElementsByName('opwd')[0].value;
		_this.topwd = document.getElementsByName('topwd')[0].value;
		if (!_this.userlogin) {
			layer.open({
			    content: '用户名不能为空！',skin: 'msg',time: 2 
			});
			return false;
		};
		if (!_this.UserLogin(_this.userlogin)) {
			layer.open({
			    content: '用户名格式有误！',skin: 'msg',time: 2 
			});
			return false;
		};
		if(_this.userlogin.length < 3){
			layer.open({
			    content: '用户名长度大于三位！',skin: 'msg',time: 2 
			});
			return false;
		};
		if(_this.userlogin.length > 6){
			layer.open({
			    content: '用户名长度小于六位！',skin: 'msg',time: 2 
			});
			return false;
		};
		if (!_this.mobile) {
			layer.open({
			    content: '手机号不能为空！',skin: 'msg',time: 2 
			});
			return false;
		};
		if (!_this.checkMobile(_this.mobile)) {
			layer.open({
			    content: '手机号格式有误！',skin: 'msg',time: 2 
			});
			return false;
		};
		if(_this.mobile != _this.mobile1){
			layer.open({
			    content: '验证码有误！',skin: 'msg',time: 2 
			});
			return false;
		};
		if (!_this.Password(_this.opwd)) {
			layer.open({
			    content: '密码格式有误！',skin: 'msg',time: 2 
			});
			return false;
		};
		if (_this.topwd != _this.opwd) {
			layer.open({
			    content: '两次密码格式有误！',skin: 'msg',time: 2 
			});
			return false;
		};
		if(!_this.agreementtype){
			layer.open({
			    content: '请先同意注册协议',skin: 'msg',time: 2 
			});
			return false;
		};
		// if(!_this.informationtype){
		// 	layer.open({
		// 	    content: '请先同意用户协议',skin: 'msg',time: 2 
		// 	});
		// 	return false;
		// };
		_this.Submitdata = {
			"user_login":_this.userlogin,
			'mobile':_this.mobile,
			'opwd':_this.opwd,
			'code':_this.code,
		};
		layer.open({type: 2 ,shadeClose:false});
		$.post(server.register,_this.Submitdata,function(response){
			layer.closeAll();
			if(response.status == '200'){
				layer.open({
				    content: '注册成功，请前往登录',skin: 'msg',time: 2 
				});
				window.setTimeout(function(){
					self.location.href="signin.html";
				},2000);
			}else {
				layer.open({
				    content: response.msg,skin: 'msg',time: 2 
				});
			};
		})
	};
};


networking.prototype.forgetpwd = function (argument) {
	var _this = this;
	_this.Return();
	document.getElementsByClassName("VerificationCode")[0].onclick = function(){
		_this.mobile = document.getElementsByName('mobile')[0].value;
		if(countdowntype){
			countdowntype = false;
		}else {
			return false;
		}
		if (!_this.mobile) {
			layer.open({
			    content: '手机号不能为空！',skin: 'msg',time: 2 
			});
			countdowntype = true;
			return false;
		};
		if (!_this.checkMobile(_this.mobile)) {
			layer.open({
			    content: '手机号格式有误！',skin: 'msg',time: 2 
			});
			countdowntype = true;
			return false;
		};
		layer.open({type: 2 ,shadeClose:false});
		$.get(server.send_sms,{'mobile':_this.mobile,'type':'2'},function(response){
			layer.closeAll();
			if(response.status == '200'){
				layer.open({
				    content: '短信验证码已发送到手机请注意查收',skin: 'msg',time: 2 
				});
				_this.mobile1 = _this.mobile;
				countdown();
			}else {
				countdowntype = true;
				layer.open({
				    content: response.msg,skin: 'msg',time: 2 
				});
			};
		});
	};
	document.getElementsByClassName("but")[0].onclick = function(){
		_this.userlogin = document.getElementsByName('userlogin')[0].value;
		_this.mobile = document.getElementsByName('mobile')[0].value;
		_this.code = document.getElementsByName('code')[0].value;
		_this.opwd = document.getElementsByName('opwd')[0].value;
		_this.topwd = document.getElementsByName('topwd')[0].value;
		if (!_this.userlogin) {
			layer.open({
			    content: '用户名不能为空！',skin: 'msg',time: 2 
			});
			return false;
		};
		if (!_this.UserLogin(_this.userlogin)) {
			layer.open({
			    content: '用户名格式有误！',skin: 'msg',time: 2 
			});
			return false;
		};
		if(_this.userlogin.length < 3){
			layer.open({
			    content: '用户名长度大于三位！',skin: 'msg',time: 2 
			});
			return false;
		};
		if(_this.userlogin.length > 6){
			layer.open({
			    content: '用户名长度小于六位！',skin: 'msg',time: 2 
			});
			return false;
		};
		if (!_this.mobile) {
			layer.open({
			    content: '手机号不能为空！',skin: 'msg',time: 2 
			});
			return false;
		};
		if (!_this.checkMobile(_this.mobile)) {
			layer.open({
			    content: '手机号格式有误！',skin: 'msg',time: 2 
			});
			return false;
		};
		if(_this.mobile != _this.mobile1){
			layer.open({
			    content: '验证码有误！',skin: 'msg',time: 2 
			});
			return false;
		};
		if (!_this.Password(_this.opwd)) {
			layer.open({
			    content: '密码格式有误！',skin: 'msg',time: 2 
			});
			return false;
		};
		if (_this.topwd != _this.opwd) {
			layer.open({
			    content: '两次密码格式有误！',skin: 'msg',time: 2 
			});
			return false;
		};
		_this.Submitdata = {
			"user_login":_this.userlogin,
			'mobile':_this.mobile,
			'opwd':_this.opwd,
			'opwd1':_this.topwd,
			'code':_this.code,
		};
		layer.open({type: 2 ,shadeClose:false});
		$.post(server.reset_opwd,_this.Submitdata,function(response){
			layer.closeAll();
			if(response.status == '200'){
				layer.open({
				    content: '密码修改成功，请前往登录',skin: 'msg',time: 2 
				});
				window.setTimeout(function(){
					self.location.href="signin.html";
				},2000);
			}else {
				layer.open({
				    content: response.msg,skin: 'msg',time: 2 
				});
			};
		})
	};
};


networking.prototype.signin = function (argument) {
	var _this = this;
	document.getElementsByClassName("but")[0].onclick = function(){
		_this.userlogin = document.getElementsByName('userlogin')[0].value;
		_this.opwd = document.getElementsByName('opwd')[0].value;
		if (!_this.userlogin) {
			layer.open({
			    content: '用户名不能为空！',skin: 'msg',time: 2 
			});
			return false;
		};
		if (!_this.UserLogin(_this.userlogin)) {
			layer.open({
			    content: '用户名格式有误！',skin: 'msg',time: 2 
			});
			return false;
		};
		if(_this.userlogin.length < 3){
			layer.open({
			    content: '用户名长度大于三位！',skin: 'msg',time: 2 
			});
			return false;
		};
		if(_this.userlogin.length > 6){
			layer.open({
			    content: '用户名长度小于六位！',skin: 'msg',time: 2 
			});
			return false;
		};
		if (!_this.Password(_this.opwd)) {
			layer.open({
			    content: '密码格式有误！',skin: 'msg',time: 2 
			});
			return false;
		};
		_this.Submitdata = {
			"user_login":_this.userlogin,
			'opwd':_this.opwd,
		};
		layer.open({type: 2 ,shadeClose:false});
		$.post(server.user_login,_this.Submitdata,function(response){
			layer.closeAll();
			if(response.status == '200'){
				layer.open({
				    content: '登录成功！',skin: 'msg',time: 2 
				});
				sessionStorage.account = response.data.account;
				sessionStorage.token = response.data.token;
				window.setTimeout(function(){
					self.location.href="index.html";
				},2000);
			}else {
				layer.open({
				    content: response.msg,skin: 'msg',time: 2 
				});
			};
		})
	};
};

var countdowntime;
function countdown(){
	var downnum = 60;
	var VerificationCode = document.getElementsByClassName('VerificationCode')[0];
	countdowntime = window.setInterval(function(){
		downnum --;
		VerificationCode.innerHTML = downnum + "秒再次获取";
		if(downnum < 0){
			VerificationCode.innerHTML = "再次获取";
			clearInterval(countdowntime);
			countdowntype = true;
		}
	},1000)
}
networking.prototype.contract = function () {
	_this = this;
	_this.Clickselection();
	_this.contracttad = $('.header_box li');
    _this.billList = $('.contract_mian ul');
	$('.contract_box2').hide();
	$('.contract_box3').hide();
    _this.contracttad.on('click', function(){
        _this.contracttad.removeClass('active');
        $(this).addClass('active');
        _this.billList.hide();
        let clikIndex = $(this).index();
        _this.billList.eq(clikIndex).show();
    });
	ajaxEve('post', server.user_info, {}, function (result) {
	    if (result.status == 200) {
	        _this.mobile1 = result.data.mobile;
	        return;
	    };
	}, function (result) {
	    return;
	});
	contractlistpost();
	function contractlistpost(){
		ajaxEve('post', server.contractlistpost, {}, function (result) {
		    if (result.status == 200) {
		        jo.reTpl($('#test1'),result,$('.contract_box1'));
		        seruer();
		        return;
		    }
		}, function (result) {
		    return;
		});
	}
	function seruer(){
		$(".right_but a").on('click',function(){
			_this.clicktype = $(this).attr('data_id');
			layer.open({type: 2 ,shadeClose:false});
			ajaxEve('post', server.contractloginpost, {'user_id':_this.clicktype}, function (result) {
				layer.closeAll();
			    if (result.status == 200) {
			    	layer.open({
					    content: '登录成功',skin: 'msg',time: 2 
					});
			    	window.sessionStorage.account = result.data.account;
			    	window.sessionStorage.token = result.data.token;
			    	accontdata = result.data.account;
					tokendata = result.data.token;
			        contractlistpost();
			    };
			}, function (result) {
			    return;
			});
		})
	};

	// 新增合约
	document.getElementsByClassName("VerificationCode")[0].onclick = function(){
		_this.mobile = document.getElementsByName('mobile')[0].value;
		if(countdowntype){
			countdowntype = false;
		}else {
			return false;
		};
		if (!_this.mobile) {
			layer.open({
			    content: '手机号不能为空！',skin: 'msg',time: 2 
			});
			countdowntype = true;
			return false;
		};
		if (!_this.checkMobile(_this.mobile)) {
			layer.open({
			    content: '手机号格式有误！',skin: 'msg',time: 2 
			});
			countdowntype = true;
			return false;
		};
		layer.open({type: 2 ,shadeClose:false});
		$.get(server.send_sms,{'mobile':_this.mobile,'type':'1'},function(response){
			layer.closeAll();
			if(response.status == '200'){
				layer.open({
				    content: '短信验证码已发送到手机请注意查收',skin: 'msg',time: 2 
				});
				_this.mobile1 = _this.mobile;
				countdown();
			}else {
				countdowntype = true;
				layer.open({
				    content: response.msg,skin: 'msg',time: 2 
				});
			};
		});
	};
	document.getElementsByClassName("but")[0].onclick = function(){
		_this.userlogin = document.getElementsByName('userlogin')[0].value;
		_this.mobile = document.getElementsByName('mobile')[0].value;
		_this.code = document.getElementsByName('code')[0].value;
		_this.opwd = document.getElementsByName('opwd')[0].value;
        _this.opwd11 = document.getElementsByName('opwd11')[0].value;
		if (!_this.userlogin) {
			layer.open({
			    content: '用户名不能为空！',skin: 'msg',time: 2 
			});
			return false;
		};
		if (!_this.UserLogin(_this.userlogin)) {
			layer.open({
			    content: '用户名格式有误！',skin: 'msg',time: 2 
			});
			return false;
		};
		if(_this.userlogin.length < 3){
			layer.open({
			    content: '用户名长度大于三位！',skin: 'msg',time: 2 
			});
			return false;
		};
		if(_this.userlogin.length > 6){
			layer.open({
			    content: '用户名长度小于六位！',skin: 'msg',time: 2 
			});
			return false;
		};
		if (!_this.mobile) {
			layer.open({
			    content: '手机号不能为空！',skin: 'msg',time: 2 
			});
			return false;
		};
		if (!_this.checkMobile(_this.mobile)) {
			layer.open({
			    content: '手机号格式有误！',skin: 'msg',time: 2 
			});
			return false;
		};
		if(_this.mobile != _this.mobile1){
			layer.open({
			    content: '验证码有误！',skin: 'msg',time: 2 
			});
			return false;
		};
		if (!_this.Password(_this.opwd)) {
			layer.open({
			    content: '密码格式有误！',skin: 'msg',time: 2 
			});
			return false;
		};
        if (!_this.opwd11) {
            layer.open({
                content: '请再次输入登录密码！',skin: 'msg',time: 2
            });
            return false;
        };
        if (_this.opwd != _this.opwd11) {
            layer.open({
                content: '两次密码输入不一致！',skin: 'msg',time: 2
            });
            return false;
        };
		if(!_this.agreementtype){
			layer.open({
			    content: '请先同意注册协议',skin: 'msg',time: 2 
			});
			return false;
		};
		// if(!_this.informationtype){
		// 	layer.open({
		// 	    content: '请先同意用户协议',skin: 'msg',time: 2 
		// 	});
		// 	return false;
		// };
		_this.Submitdata = {
			"user_login":_this.userlogin,
			'mobile':_this.mobile,
			'opwd':_this.opwd,
			'code':_this.code,
		};
		layer.open({type: 2 ,shadeClose:false});
		ajaxEve('post', server.contractaddpost, _this.Submitdata, function (result) {
		    layer.closeAll();
			if(result.status == '200'){
				layer.open({
				    content: '开通成功',skin: 'msg',time: 2 
				});
				window.setTimeout(function(){
					self.location.href="signin.html";
				},2000);
				sessionStorage.clear();
			}else {
				layer.open({
				    content: result.msg,skin: 'msg',time: 2 
				});
			};
		}, function (result) {
            layer.open({
                content: result.msg,skin: 'msg',time: 2
            });
		    return;
		});
	};
	// 关联合约
	document.getElementsByClassName("VerificationCode1")[0].onclick = function(){
		if(countdowntype){
			countdowntype = false;
		}else {
			return false;
		};
		layer.open({type: 2 ,shadeClose:false});
		$.get(server.send_sms,{'mobile':_this.mobile1,'type':'3'},function(response){
			layer.closeAll();
			if(response.status == '200'){
				layer.open({
				    content: '短信验证码已发送到手机请注意查收',skin: 'msg',time: 2 
				});
				countdown();
			}else {
				countdowntype = true;
				layer.open({
				    content: response.msg,skin: 'msg',time: 2 
				});
			};
		});
	};
	document.getElementsByClassName("but1")[0].onclick = function(){
		_this.userlogin = document.getElementsByName('userlogin1')[0].value;
		_this.code = document.getElementsByName('code1')[0].value;
		_this.opwd = document.getElementsByName('opwd1')[0].value;
		if (!_this.userlogin) {
			layer.open({
			    content: '用户名不能为空！',skin: 'msg',time: 2 
			});
			return false;
		};
		if (!_this.UserLogin(_this.userlogin)) {
			layer.open({
			    content: '用户名格式有误！',skin: 'msg',time: 2 
			});
			return false;
		};
		if(_this.userlogin.length < 3){
			layer.open({
			    content: '用户名长度大于三位！',skin: 'msg',time: 2 
			});
			return false;
		};
		if(_this.userlogin.length > 6){
			layer.open({
			    content: '用户名长度小于六位！',skin: 'msg',time: 2 
			});
			return false;
		};
		if (!_this.Password(_this.opwd)) {
			layer.open({
			    content: '密码格式有误！',skin: 'msg',time: 2 
			});
			return false;
		};
		_this.Submitdata = {
			"new_user_login":_this.userlogin,
			'mobile':_this.mobile1,
			'new_opwd':_this.opwd,
			'code':_this.code,
		};
		layer.open({type: 2 ,shadeClose:false});
		ajaxEve('post', server.contractrelationpost, _this.Submitdata, function (result) {
		    layer.closeAll();
			if(result.status == '200'){
				layer.open({
				    content: '开通成功',skin: 'msg',time: 2 
				});
                window.location.reload();
			}else {
				layer.open({
				    content: result.msg,skin: 'msg',time: 2 
				});
			};
		}, function (result) {
			layer.closeAll();
            layer.open({
                content: result.msg,skin: 'msg',time: 2
            });
		    return;
		});
	};
};
var province =  ["北京市", "天津市", "河北省", "河南省", "山西省", "山东省", "内蒙古自治区", "辽宁省", "吉林省", "黑龙江省", "上海市", "江苏省", "浙江省", "福建省", "江西省", "安徽省", "湖北省", "湖南省", "广东省", "广西壮族自治区", "海南省", "重庆市", "四川省", "贵州省", "云南省", "西藏自治区", "陕西省", "甘肃省", "青海省", "宁夏回族自治区", "新疆维吾尔自治区", "台湾省", "香港特别行政区", "澳门特别行政区"];
var city = [
    ["市辖区"],
    ["市辖区", "市辖县"],
    ["石家庄市", "唐山市", "秦皇岛市", "邯郸市", "邢台市", "保定市", "张家口市", "承德市", "沧州市", "廊坊市", "衡水市", "省直辖县级行政单位"],
    ["郑州市", "开封市", "洛阳市", "平顶山市", "安阳市", "鹤壁市", "新乡市", "焦作市", "濮阳市", "许昌市", "漯河市", "三门峡市", "商丘市", "周口市", "驻马店市", "南阳市", "信阳市", "省直辖县级行政单位"],
    ["太原市", "大同市", "阳泉市", "长治市", "晋城市", "朔州市", "晋中市", "运城市", "忻州市", "临汾市", "吕梁市"],
    ["济南市", "青岛市", "淄博市", "枣庄市", "东营市", "烟台市", "潍坊市", "济宁市", "泰安市", "威海市", "日照市", "滨州市", "德州市", "聊城市", "临沂市", "菏泽市", "莱芜市"],
    ["呼和浩特市", "包头市", "乌海市", "赤峰市", "通辽市", "鄂尔多斯市", "呼伦贝尔市", "巴彦淖尔市", "乌兰察布市", "兴安盟", "锡林郭勒盟", "阿拉善盟"],
    ["沈阳市", "大连市", "鞍山市", "抚顺市", "本溪市", "丹东市", "锦州市", "营口市", "阜新市", "辽阳市", "盘锦市", "铁岭市", "朝阳市", "葫芦岛市", "省直辖县级行政单位"],
    ["长春市", "吉林市", "四平市", "辽源市", "通化市", "白山市", "白城市", "松原市", "延边朝鲜族自治州", "长白山保护开发区", "省直辖县级行政单位"],
    ["哈尔滨市", "齐齐哈尔市", "鸡西市", "鹤岗市", "双鸭山市", "大庆市", "伊春市", "佳木斯市", "七台河市", "牡丹江市", "黑河市", "绥化市", "大兴安岭地区", "省直辖县级行政单位"],
    ["市辖区", "市辖县"],
    ["南京市", "无锡市", "徐州市", "常州市", "苏州市", "南通市", "连云港市", "淮安市", "盐城市", "扬州市", "镇江市", "泰州市", "宿迁市", "省直辖县级行政单位"],
    ["杭州市", "宁波市", "温州市", "绍兴市", "湖州市", "嘉兴市", "金华市", "衢州市", "台州市", "丽水市", "舟山市", "省直辖县级行政单位"],
    ["福州市", "厦门市", "莆田市", "泉州市", "漳州市", "龙岩市", "三明市", "南平市", "宁德市"],
    ["南昌市", "赣州市", "宜春市", "吉安市", "上饶市", "抚州市", "九江市", "景德镇市", "萍乡市", "新余市", "鹰潭市", "省直辖县级行政单位"],
    ["合肥市", "芜湖市", "蚌埠市", "淮南市", "马鞍山市", "淮北市", "铜陵市", "安庆市", "黄山市", "阜阳市", "宿州市", "滁州市", "六安市", "宣城市", "池州市", "亳州市", "省直辖县级行政单位"],
    ["武汉市", "黄石市", "十堰市", "荆州市", "宜昌市", "襄阳市", "鄂州市", "荆门市", "黄冈市", "孝感市", "咸宁市", "随州市", "恩施土家族苗族自治州", "省直辖县级行政单位"],
    ["长沙市", "株洲市", "湘潭市", "衡阳市", "邵阳市", "岳阳市", "张家界市", "益阳市", "常德市", "娄底市", "郴州市", "永州市", "怀化市", "湘西土家族苗族自治州", "省直辖县级行政单位"],
    ["广州市", "深圳市", "珠海市", "汕头市", "佛山市", "韶关市", "湛江市", "肇庆市", "江门市", "茂名市", "惠州市", "梅州市", "汕尾市", "河源市", "阳江市", "清远市", "东莞市", "中山市", "潮州市", "揭阳市", "云浮市"],
    ["南宁市", "柳州市", "桂林市", "梧州市", "北海市", "崇左市", "来宾市", "贺州市", "玉林市", "百色市", "河池市", "钦州市", "防城港市", "贵港市"],
    ["海口市", "三亚市", "三沙市", "儋州市", "省直辖县级行政单位"],
    ["市辖区", "市辖县"],
    ["成都市", "绵阳市", "自贡市", "攀枝花市", "泸州市", "德阳市", "广元市", "遂宁市", "内江市", "乐山市", "资阳市", "宜宾市", "南充市", "达州市", "雅安市", "广安市", "巴中市", "眉山市", "阿坝藏族羌族自治州", "甘孜藏族自治州", "凉山彝族自治州"],
    ["贵阳市", "六盘水市", "遵义市", "安顺市", "毕节市", "铜仁市", "黔西南布依族苗族自治州", "黔东南苗族侗族自治州", "黔南布依族苗族自治州", "省直辖县级行政单位"],
    ["昆明市", "昭通市", "曲靖市", "玉溪市", "普洱市", "保山市", "丽江市", "临沧市", "楚雄彝族自治州", "红河哈尼族彝族自治州", "文山壮族苗族自治州", "西双版纳傣族自治州", "大理白族自治州", "德宏傣族景颇族自治州", "怒江傈僳族自治州", "迪庆藏族自治州"],
    ["拉萨市", "昌都市", "日喀则市", "林芝市", "山南市", "那曲地区", "阿里地区"],
    ["西安市", "铜川市", "宝鸡市", "咸阳市", "渭南市", "汉中市", "安康市", "商洛市", "延安市", "榆林市", "杨凌农业高新技术产业示范区", "省直辖县级行政单位"],
    ["兰州市", "嘉峪关市", "金昌市", "白银市", "天水市", "酒泉市", "张掖市", "武威市", "定西市", "陇南市", "平凉市", "庆阳市", "临夏回族自治州", "甘南藏族自治州"],
    ["西宁市", "海东市", "海北藏族自治州", "海南藏族自治州", "海西蒙古族藏族自治州", "黄南藏族自治州", "果洛藏族自治州", "玉树藏族自治州"],
    ["银川市", "石嘴山市", "吴忠市", "固原市", "中卫市", "省直辖县级行政单位"],
    ["乌鲁木齐市", "克拉玛依市", "吐鲁番市", "哈密市", "阿克苏地区", "喀什地区", "和田地区", "伊犁哈萨克自治州", "昌吉回族自治州", "博尔塔拉蒙古自治州", "巴音郭楞蒙古自治州", "克孜勒苏柯尔克孜自治州", "省直辖县级行政单位"],
    ["台北市", "新北市", "桃园市", "台中市", "台南市", "高雄市", "基隆市", "新竹市", "嘉义市", "省直辖县级行政单位", "钓鱼岛列岛"],
    ["香港岛", "九龙半岛", "新界"],
    ["澳门半岛", "离岛", "无堂区划分区域"]
];
var district =  [
    /*北京市*/
    [["东城区", "西城区", "朝阳区", "海淀区", "石景山区", "丰台区", "通州区", "顺义区", "昌平区", "门头沟区", "房山区", "大兴区", "平谷区", "怀柔区", "密云区", "延庆区"]],
    /*天津市*/
    [
        ["和平区", "河东区", "河西区", "河北区", "南开区", "红桥区", "滨海新区", "东丽区", "西青区", "津南区", "北辰区", "武清区", "宝坻区", "宁河区", "静海区"],
        ["蓟县"]
    ],
    /*河北省*/
    [
        ["长安区", "桥西区", "新华区", "井陉矿区", "裕华区", "藁城区", "鹿泉区", "栾城区", "晋州市", "新乐市", "井陉县", "正定县", "行唐县", "灵寿县", "高邑县", "深泽县", "赞皇县", "无极县", "平山县", "元氏县", "赵县"],
        ["路北区", "路南区", "古冶区", "开平区", "丰南区", "丰润区", "遵化市", "迁安市", "曹妃甸区", "滦县", "滦南县", "乐亭县", "迁西县", "玉田县"],
        ["海港区", "山海关区", "抚宁区", "北戴河区", "青龙满族自治县", "昌黎县", "卢龙县"],
        ["邯山区", "丛台区", "复兴区", "峰峰矿区", "武安市", "邯郸县", "临漳县", "成安县", "大名县", "涉县", "磁县", "肥乡县", "永年县", "邱县", "鸡泽县", "广平县", "馆陶县", "曲周县", "魏县"],
        ["桥东区", "桥西区", "南宫市", "沙河市", "邢台县", "临城县", "内丘县", "柏乡县", "隆尧县", "任县", "南和县", "巨鹿县", "新和县", "广宗县", "平乡县", "威县", "清河县", "临西县", "宁晋县"],
        ["竞秀区", "莲池区", "满城区", "清苑区", "徐水区", "安国市", "高碑店市", "涿州市", "涞水县", "阜平县", "定兴县", "唐县", "高阳县", "容城县", "涞源县", "望都县", "安新县", "易县", "曲阳县", "蠡县", "顺平县", "博野县", "雄县"],
        ["桥东区", "桥西区", "宣化区", "下花园区", "崇礼区", "万全区", "张北县", "康保县", "沽源县", "尚义县", "蔚县", "阳原县", "怀安县", "涿鹿县", "赤城县", "怀来县"],
        ["双桥区", "双滦区", "鹰手营子矿区", "承德县", "兴隆县", "滦平县", "隆化县", "平泉县", "丰宁满族自治县", "宽城满族自治县", "围场满族蒙古族自治县"],
        ["运河区", "新华区", "泊头市", "黄骅市", "河间市", "任丘市", "沧县", "青县", "东光县", "海兴县", "盐山县", "肃宁县", "南皮县", "吴桥县", "献县", "孟村回族自治县"],
        ["广阳区", "安次区", "霸州市", "三河市", "固安县", "永清县", "香河县", "大城县", "文安县", "大厂回族自治县"],
        ["桃城区", "冀州市", "深州市", "枣强县", "武邑县", "武强县", "饶阳县", "安平县", "故城县", "阜城县", "景县"],
        ["定州市", "辛集市"]
    ],
    /*河南省*/
    [
        ["中原区", "二七区", "金水区", "惠济区", "管城区", "上街区", "新郑市", "登封市", "荥阳市", "新密市", "中牟县"],
        ["龙亭区", "鼓楼区", "禹王台区", "顺河区", "祥符区", "通许县", "杞县", "尉氏县"],
        ["涧西区", "西工区", "老城区", "瀍河区", "洛龙区", "吉利区", "偃师市", "宜阳县", "孟津县", "新安县", "洛宁县", "栾川县", "伊川县", "汝阳县", "嵩县"],
        ["新华区", "卫东区", "石龙区", "湛河区", "舞钢市", "鲁山县", "宝丰县", "叶县", "郏县"],
        ["文峰区", "北关区", "殷都区", "龙安区", "林州市", "安阳县", "汤阴县", "内黄县"],
        ["鹤山区", "山城区", "淇滨区", "浚县", "淇县"],
        ["红旗区", "卫滨区", "牧野区", "凤泉区", "卫辉市", "辉县市", "新乡县", "获嘉县", "原阳县", "延津县", "封丘县"],
        ["山阳区", "中站区", "解放区", "马村区", "沁阳市", "孟州市", "修武县", "博爱县", "武陟县", "温县"],
        ["华龙区", "濮阳县", "清丰县", "南乐县", "台前县", "范县"],
        ["魏都区", "禹州市", "长葛市", "许昌县", "鄢陵县", "襄城县"],
        ["郾城区", "源汇区", "召陵区", "舞阳县", "临颍县"],
        ["湖滨区", "陕州区", "灵宝市", "义马市", "渑池县", "卢氏县"],
        ["睢阳区", "梁园区", "民权县", "宁陵县", "柘城县", "虞城县", "夏邑县", "睢县"],
        ["川汇区", "项城市", "扶沟县", "西华县", "商水县", "沈丘县", "淮阳县", "郸城县", "太康县"],
        ["驿城区", "西平县", "遂平县", "平舆县", "上蔡县", "正阳县", "泌阳县", "确山县", "汝南县"],
        ["宛城区", "卧龙区", "南召县", "西峡县", "方城县", "镇平县", "内乡县", "淅川县", "社旗县", "唐河县", "新野县", "桐柏县"],
        ["浉河区", "平桥区", "罗山县", "光山县", "潢川县", "淮滨县", "商城县", "新县", "息县"],
        ["济源市", "巩义市", "汝州市", "永城市", "邓州市", "兰考县", "滑县", "长垣县", "鹿邑县", "新蔡县", "固始县"]
    ],
    /*山西省*/
    [
        ["迎泽区", "杏花岭区", "万柏林区", "尖草坪区", "小店区", "晋源区", "清徐县", "阳曲县", "娄烦县", "古交市"],
        ["城区", "矿区", "南郊区", "新荣区", "左云县", "大同县", "天镇县", "浑源县", "广灵县", "灵丘县", "阳高县"],
        ["城区", "矿区", "郊区", "盂县", "平定县"],
        ["城区", "郊区", "潞城市", "长治县", "襄垣县", "屯留县", "平顺县", "黎城县", "壶关县", "长子县", "武乡县", "沁县", "沁源县"],
        ["城区", "高平市", "泽州县", "阳城县", "陵川县", "沁水县"],
        ["朔城区", "平鲁区", "山阴县", "应县", "怀仁县", "右玉县"],
        ["榆次区", "介休市", "榆社县", "左权县", "和顺县", "昔阳县", "寿阳县", "太谷县", "祁县", "平遥县", "灵石县"],
        ["盐湖区", "河津市", "永济市", "临猗县", "芮城县", "万荣县", "新绛县", "稷山县", "闻喜县", "夏县", "绛县", "平陆县", "垣曲县"],
        ["忻府区", "原平市", "定襄县", "五台县", "代县", "繁峙县", "宁武县", "静乐县", "神池县", "五寨县", "岢岚县", "偏关县", "河曲县", "保德县"],
        ["尧都区", "侯马市", "霍州市", "曲沃县", "翼城县", "襄汾县", "洪洞县", "古县", "浮山县", "吉县", "乡宁县", "蒲县", "大宁县", "永和县", "汾西县", "隰县", "安泽县"],
        ["离石区", "孝义市", "汾阳市", "文水县", "交城县", "兴县", "临县", "柳林县", "岚县", "石楼县", "交口县", "方山县", "中阳县"]
    ],
    /*山东省*/
    [
        ["历下区", "市中区", "槐荫区", "天桥区", "历城区", "长清区", "章丘市", "平阴县", "济阳县", "商河县"],
        ["市南区", "市北区", "李沧区", "城阳区", "崂山区", "黄岛区", "即墨市", "胶州市", "平度市", "莱西市"],
        ["张店区", "淄川区", "周村区", "博山区", "临淄区", "桓台县", "高青县", "沂源县"],
        ["薛城区", "市中区", "峄城区", "山亭区", "台儿庄区", "滕州市"],
        ["东营区", "河口区", "广饶县", "垦利县", "利津县"],
        ["莱山区", "芝罘区", "福山区", "牟平区", "龙口市", "莱阳市", "莱州市", "蓬莱市", "招远市", "栖霞市", "海阳市", "长岛县"],
        ["奎文区", "潍城区", "寒亭区", "坊子区", "诸城市", "青州市", "寿光市", "安丘市", "昌邑市", "高密市", "临朐县", "昌乐县"],
        ["任城区", "兖州区", "邹城市", "曲阜市", "嘉祥县", "汶上县", "梁山县", "微山县", "鱼台县", "金乡县", "泗水县"],
        ["泰山区", "岱岳区", "新泰市", "肥城市", "宁阳县", "东平县"],
        ["环翠区", "文登区", "荣成市", "乳山市"],
        ["东港区", "岚山区", "五莲县", "莒县"],
        ["滨城区", "沾化区", "惠民县", "阳信县", "无棣县", "博兴县", "邹平县"],
        ["德城区", "陵城区", "乐陵市", "禹城市", "临邑县", "平原县", "夏津县", "武城县", "庆云县", "宁津县", "齐河县"],
        ["东昌府区", "聊城开发区", "临清市", "茌平县", "东阿县", "高唐县", "阳谷县", "冠县", "莘县"],
        ["兰山区", "河东区", "罗庄区", "兰陵县", "郯城县", "莒南县", "沂水县", "蒙阴县", "平邑县", "沂南县", "临沭县", "费县"],
        ["牡丹区", "定陶区", "曹县", "单县", "巨野县", "成武县", "郓城县", "鄄城县", "东明县"],
        ["莱城区", "钢城区"]
    ],
    /*内蒙古自治区*/
    [
        ["回民区", "新城区", "玉泉区", "赛罕区", "土默特左旗", "托克托县", "和林格尔县", "武川县", "清水河县"],
        ["昆都仑区", "东河区", "青山区", "石拐区", "九原区", "白云鄂博矿区", "土默特右旗", "固阳县", "达尔罕茂明安联合旗"],
        ["海勃湾区", "海南区", "乌达区"],
        ["红山区", "元宝山区", "松山区", "阿鲁科尔沁旗", "巴林左旗", "巴林右旗", "林西县", "克什克腾旗", "翁牛特旗", "喀喇沁旗", "宁城县", "敖汉旗"],
        ["科尔沁区", "霍林郭勒市", "科尔沁左翼中旗", "科尔沁左翼后旗", "开鲁县", "库伦旗", "奈曼旗", "扎鲁特旗"],
        ["东胜区", "达拉特旗", "准格尔旗", "鄂托克前旗", "鄂托克旗", "杭锦旗", "乌审旗", "伊金霍洛旗"],
        ["海拉尔区", "满洲里市", "牙克石市", "扎兰屯市", "额尔古纳市", "根河市", "阿荣旗", "鄂伦春自治旗", "莫力达瓦达斡尔族自治旗", "鄂温克族自治旗", "陈巴尔虎旗", "新巴尔虎左旗", "新巴尔虎右旗"],
        ["临河区", "五原县", "磴口县", "乌拉特前旗", "乌拉特中旗", "乌拉特后旗", "杭锦后旗"],
        ["集宁区", "丰镇市", "卓资县", "化德县", "商都县", "兴和县", "凉城县", "察哈尔右翼前旗", "察哈尔右翼中旗", "察哈尔右翼后旗", "四子王旗"],
        ["乌兰浩特市", "阿尔山市", "科尔沁右翼前旗", "科尔沁右翼中旗", "扎赉特旗", "突泉县"],
        ["锡林浩特市", "二连浩特市", "阿巴嘎旗", "苏尼特左旗", "苏尼特右旗", "东乌珠穆沁旗", "西乌珠穆沁旗", "太仆寺旗", "镶黄旗", "正镶白旗", "正蓝旗", "多伦县"],
        ["阿拉善左旗", "阿拉善右旗", "额济纳旗"]
    ],
    /*辽宁省*/
    [
        ["和平区", "沈河区", "大东区", "皇姑区", "铁西区", "苏家屯区", "浑南区", "沈北新区", "于洪区", "新民市", "辽中县", "康平县", "法库县"],
        ["西岗区", "中山区", "沙河口区", "甘井子区", "旅顺口区", "金州区", "瓦房店市", "普兰店市", "庄河市", "长海县"],
        ["铁东区", "铁西区", "立山区", "千山区", "海城市", "台安县", "岫岩满族自治县"],
        ["新抚区", "东洲区", "望花区", "顺城区", "抚顺县", "新宾满族自治县", "清原满族自治县"],
        ["平山区", "溪湖区", "明山区", "南芬区", "本溪满族自治县", "桓仁满族自治县"],
        ["元宝区", "振兴区", "振安区", "东港市", "凤城市", "宽甸满族自治县"],
        ["古塔区", "凌河区", "太和区", "松山新区", "凌海市", "北镇市", "黑山县", "义县"],
        ["站前区", "西市区", "老边区", "鲅鱼圈区", "大石桥市", "盖州市"],
        ["海州区", "太平区", "新邱区", "细河区", "清河门区", "阜新蒙古族自治县", "彰武县"],
        ["白塔区", "文圣区", "宏伟区", "弓长岭区", "太子河区", "灯塔市", "辽阳县"],
        ["双台子区", "兴隆台区", "盘山县", "大洼县"],
        ["银州区", "清河区", "调兵山市", "开原市", "铁岭县", "西丰县"],
        ["双塔区", "龙城区", "北票市", "凌源市", "朝阳县", "建平县", "喀喇沁左翼蒙古族自治县"],
        ["连山区", "南票区", "龙港区", "兴城市", "建昌县"],
        ["昌图县", "绥中县"]
    ],
    /*吉林省*/
    [
        ["南关区", "朝阳区", "绿园区", "二道区", "双阳区", "宽城区", "九台区", "榆树市", "德惠市", "农安县"],
        ["船营区", "龙潭区", "昌邑区", "丰满区", "磐石市", "桦甸市", "蛟河市", "舒兰市", "永吉县"],
        ["铁西区", "铁东区", "双辽市", "梨树县", "伊通满族自治县", "辽河农垦管理区"],
        ["龙山区", "西安区", "东丰县", "东辽县"],
        ["东昌区", "二道江区", "集安市", "通化县", "辉南县", "柳河县"],
        ["浑江区", "江源区", "临江市", "抚松县", "靖宇县", "长白朝鲜族自治县"],
        ["洮北区", "洮南市", "大安市", "镇赉县", "通榆县"],
        ["宁江区", "扶余市", "乾安县", "长岭县", "前郭尔罗斯蒙古族自治县"],
        ["延吉市", "图们市", "敦化市", "和龙市", "珲春市", "龙井市", "汪清县", "安图县"],
        ["池北区", "池西区", "池南区"],
        ["公主岭市", "梅河口市"]
    ],
    /*黑龙江省*/
    [
        ["道里区", "道外区", "南岗区", "平房区", "松北区", "香坊区", "呼兰区", "阿城区", "双城区", "尚志市", "五常市", "依兰县", "方正县", "宾县", "巴彦县", "木兰县", "通河县", "延寿县"],
        ["龙沙区", "建华区", "铁锋区", "昂昂溪区", "富拉尔基区", "碾子山区", "梅里斯达斡尔族区", "讷河市", "龙江县", "依安县", "泰来县", "甘南县", "富裕县", "克山县", "克东县", "拜泉县"],
        ["鸡冠区", "恒山区", "滴道区", "梨树区", "城子河区", "麻山区", "虎林市", "密山市", "鸡东县"],
        ["向阳区", "工农区", "南山区", "兴安区", "东山区", "兴山区", "萝北县", "绥滨县"],
        ["尖山区", "岭东区", "四方台区", "宝山区", "集贤县", "友谊县", "宝清县", "饶河县"],
        ["萨尔图区", "龙凤区", "让胡路区", "红岗区", "大同区", "肇州县", "肇源县", "林甸县", "杜尔伯特蒙古族自治县"],
        ["伊春区", "南岔区", "友好区", "西林区", "翠峦区", "新青区", "美溪区", "金山屯区", "五营区", "乌马河区", "汤旺河区", "带岭区", "乌伊岭区", "红星区", "上甘岭区", "铁力市", "嘉荫县"],
        ["向阳区", "前进区", "东风区", "郊区", "同江市", "富锦市", "桦南县", "桦川县", "汤原县"],
        ["新兴区", "桃山区", "茄子河区", "勃利县"],
        ["东安区", "阳明区", "爱民区", "西安区", "海林市", "宁安市", "穆棱市", "东宁市", "林口县"],
        ["爱辉区", "北安市", "五大连池市", "嫩江县", "逊克县", "孙吴县"],
        ["北林区", "安达市", "肇东市", "海伦市", "望奎县", "兰西县", "青冈县", "庆安县", "明水县", "绥棱县"],
        ["加格达奇区", "松岭区", "新林区", "呼中区", "呼玛县", "塔河县", "漠河县"],
        ["抚远市", "绥芬河市"]
    ],
    /*上海市*/
    [
        ["黄浦区", "徐汇区", "长宁区", "静安区", "普陀区", "虹口区", "杨浦区", "浦东新区", "闵行区", "宝山区", "嘉定区", "金山区", "松江区", "青浦区", "奉贤区"],
        ["崇明县"]
    ],
    /*江苏省*/
    [
        ["玄武区", "秦淮区", "鼓楼区", "建邺区", "栖霞区", "雨花台区", "江宁区", "浦口区", "六合区", "溧水区", "高淳区"],
        ["新吴区", "梁溪区", "锡山区", "惠山区", "滨湖区", "江阴市", "宜兴市"],
        ["云龙区", "鼓楼区", "贾汪区", "泉山区", "铜山区", "邳州市", "新沂市", "丰县", "沛县", "睢宁县"],
        ["天宁区", "钟楼区", "新北区", "武进区", "金坛区", "溧阳市"],
        ["姑苏区", "虎丘区", "吴中区", "相城区", "吴江区", "张家港市", "太仓市", "常熟市"],
        ["崇川区", "港闸区", "通州区", "如皋市", "海门市", "启东市", "海安县", "如东县"],
        ["连云区", "海州区", "赣榆区", "东海县", "灌云县", "灌南县"],
        ["清河区", "清浦区", "淮安区", "淮阴区", "涟水县", "洪泽县", "盱眙县", "金湖县"],
        ["亭湖区", "盐都区", "大丰区", "东台市", "响水县", "滨海县", "阜宁县", "射阳县", "建湖县"],
        ["广陵区", "邗江区", "江都区", "仪征市", "高邮市", "宝应县"],
        ["京口区", "润州区", "丹徒区", "丹阳市", "扬中市", "句容市"],
        ["海陵区", "高港区", "姜堰区", "兴化市", "靖江市"],
        ["宿城区", "宿豫区", "泗阳县", "泗洪县"],
        ["昆山市", "泰兴市", "沭阳县"]
    ],
    /*浙江省*/
    [
        ["上城区", "下城区", "江干区", "拱墅区", "西湖区", "滨江区", "余杭区", "萧山区", "富阳区", "建德市", "临安市", "桐庐县", "淳安县"],
        ["海曙区", "江东区", "江北区", "北仑区", "镇海区", "鄞州区", "余姚市", "慈溪市", "奉化市", "象山县", "宁海县"],
        ["鹿城区", "龙湾区", "瓯海区", "洞头区", "瑞安市", "乐清市", "永嘉县", "平阳县", "苍南县", "文成县", "泰顺县"],
        ["越城区", "柯桥区", "上虞区", "诸暨市", "嵊州市", "新昌县"],
        ["吴兴区", "南浔区", "德清县", "长兴县", "安吉县"],
        ["南湖区", "秀洲区", "海宁市", "平湖市", "桐乡市", "嘉善县", "海盐县"],
        ["婺城区", "金东区", "兰溪市", "东阳市", "永康市", "武义县", "浦江县", "磐安县"],
        ["柯城区", "衢江区", "江山市", "常山县", "开化县", "龙游县"],
        ["椒江区", "黄岩区", "路桥区", "临海市", "温岭市", "玉环县", "三门县", "天台县", "仙居县"],
        ["莲都区", "龙泉市", "青田县", "缙云县", "遂昌县", "松阳县", "云和县", "庆元县", "景宁畲族自治县"],
        ["定海区", "普陀区", "岱山县", "嵊泗县"],
        ["义乌市"]
    ],
    /*福建省*/
    [
        ["鼓楼区", "台江区", "仓山区", "马尾区", "晋安区", "福清市", "长乐市", "平潭县", "闽侯县", "连江县", "罗源县", "闽清县", "永泰县"],
        ["思明区", "海沧区", "湖里区", "集美区", "同安区", "翔安区"],
        ["城厢区", "涵江区", "荔城区", "秀屿区", "仙游县"],
        ["丰泽区", "鲤城区", "洛江区", "泉港区", "石狮市", "晋江市", "南安市", "惠安县", "安溪县", "永春县", "德化县", "金门县"],
        ["芗城区", "龙文区", "龙海市", "漳浦县", "南靖县", "云霄县", "平和县", "华安县", "长泰县", "诏安县", "东山县"],
        ["新罗区", "永定区", "漳平市", "长汀县", "上杭县", "武平县", "连城县"],
        ["梅列区", "三元区", "永安市", "明溪县", "清流县", "宁化县", "大田县", "尤溪县", "沙县", "将乐县", "泰宁县", "建宁县"],
        ["延平区", "建阳区", "邵武市", "武夷山市", "建瓯市", "顺昌县", "浦城县", "光泽县", "松溪县", "政和县"],
        ["蕉城区", "东侨新区", "福安市", "福鼎市", "霞浦县", "古田县", "屏南县", "寿宁县", "周宁县", "柘荣县"]
    ],
    /*江西省*/
    [
        ["东湖区", "西湖区", "青云谱区", "湾里区", "青山湖区", "新建区", "南昌县", "安义县", "进贤县"],
        ["章贡区", "南康区", "信丰县", "大余县", "赣县", "龙南县", "定南县", "全南县", "寻乌县", "安远县", "宁都县", "于都县", "会昌县", "石城县", "上犹县", "兴国县", "崇义县"],
        ["袁州区", "高安市", "樟树市", "奉新县", "万载县", "上高县", "宜丰县", "靖安县", "铜鼓县"],
        ["吉州区", "青原区", "井冈山市", "吉安县", "吉水县", "新干县", "永丰县", "泰和县", "遂川县", "万安县", "永新县", "峡江县"],
        ["信州区", "广丰区", "德兴市", "上饶县", "玉山县", "铅山县", "横峰县", "弋阳县", "余干县", "万年县", "婺源县"],
        ["临川区", "黎川县", "南丰县", "崇仁县", "乐安县", "宜黄县", "金溪县", "资溪县", "东乡县", "广昌县"],
        ["浔阳区", "濂溪区", "庐山市", "瑞昌市", "九江县", "永修县", "德安县", "都昌县", "湖口县", "彭泽县", "武宁县", "修水县"],
        ["昌江区", "珠山区", "乐平市", "浮梁县"],
        ["安源区", "湘东区", "莲花县", "上栗县", "芦溪县"],
        ["渝水区", "分宜县"],
        ["月湖区", "贵溪市", "余江县"],
        ["共青城市", "瑞金市", "丰城市", "鄱阳县", "安福县", "南城县"]
    ],
    /*安徽省*/
    [
        ["瑶海区", "庐阳区", "蜀山区", "包河区", "巢湖市", "肥东县", "肥西县", "长丰县", "庐江县"],
        ["镜湖区", "弋江区", "鸠江区", "三山区", "无为县", "芜湖县", "繁昌县", "南陵县"],
        ["龙子湖区", "蚌山区", "禹会区", "淮上区", "五河县", "固镇县", "怀远县"],
        ["大通区", "田家庵区", "谢家集区", "八公山区", "潘集区", "凤台县", "寿县"],
        ["花山区", "雨山区", "博望区", "含山县", "和县", "当涂县"],
        ["相山区", "杜集区", "烈山区", "濉溪县"],
        ["铜官区", "义安区", "郊区", "枞阳县"],
        ["迎江区", "大观区", "宜秀区", "桐城市", "怀宁县", "潜山县", "太湖县", "望江县", "岳西县"],
        ["黄山区", "徽州区", "屯溪区", "歙县", "休宁县", "黟县", "祁门县"],
        ["颍州区", "颍泉区", "颍东区", "界首市", "颍上县", "临泉县", "阜南县", "太和县"],
        ["埇桥区", "萧县", "砀山县", "灵璧县", "泗县"],
        ["琅琊区", "南谯区", "天长市", "明光市", "全椒县", "来安县", "凤阳县", "定远县"],
        ["金安区", "裕安区", "叶集区", "霍邱县", "霍山县", "金寨县", "舒城县"],
        ["宣州区", "宁国市", "郎溪县", "泾县", "绩溪县", "旌德县"],
        ["贵池区", "青阳县", "石台县", "东至县"],
        ["谯城区", "蒙城县", "涡阳县", "利辛县"],
        ["广德县", "宿松县"]
    ],
    /*湖北省*/
    [
        ["江岸区", "江汉区", "硚口区", "汉阳区", "武昌区", "青山区", "洪山区", "东西湖区", "黄陂区", "新洲区", "江夏区", "汉南区", "蔡甸区"],
        ["黄石港区", "西塞山区", "铁山区", "下陆区", "大冶市", "阳新县"],
        ["郧阳区", "茅箭区", "张湾区", "丹江口市", "房县", "竹山县", "竹溪县", "郧西县"],
        ["荆州区", "沙市区", "洪湖市", "松滋市", "石首市", "江陵县", "公安县", "监利县"],
        ["夷陵区", "猇亭区", "西陵区", "点军区", "伍家岗区", "宜都市", "枝江市", "当阳市", "秭归县", "远安县", "兴山县", "长阳土家族自治县", "五峰土家族自治县"],
        ["襄城区", "樊城区", "襄州区", "宜城市", "枣阳市", "老河口市", "保康县", "谷城县", "南漳县"],
        ["鄂城区", "华容区", "梁子湖区"],
        ["掇刀区", "东宝区", "钟祥市", "京山县", "沙洋县"],
        ["黄州区", "武穴市", "麻城市", "红安县", "黄梅县", "罗田县", "蕲春县", "团风县", "浠水县", "英山县"],
        ["孝南区", "安陆市", "汉川市", "应城市", "大悟县", "孝昌县", "云梦县"],
        ["咸安区", "赤壁市", "崇阳县", "嘉鱼县", "通城县", "通山县"],
        ["曾都区", "广水市", "随县"],
        ["恩施市", "利川市", "巴东县", "鹤峰县", "建始县", "来凤县", "宣恩县", "咸丰县"],
        ["潜江市", "天门市", "仙桃市", "神农架林区"]
    ],
    /*湖南省*/
    [
        ["芙蓉区", "天心区", "岳麓区", "开福区", "雨花区", "望城区", "长沙县", "宁乡县"],
        ["天元区", "荷塘区", "芦淞区", "石峰区", "云龙示范区", "醴陵市", "株洲县", "攸县", "炎陵县"],
        ["雨湖区", "岳塘区", "韶山市", "湘潭县"],
        ["雁峰区", "石鼓区", "珠晖区", "蒸湘区", "南岳区", "常宁市", "衡阳县", "衡山县", "衡南县", "衡东县", "祁东县"],
        ["双清区", "大祥区", "北塔区", "邵阳县", "邵东县", "新邵县", "隆回县", "洞口县", "绥宁县", "武宁县", "城步苗族自治县"],
        ["岳阳楼区", "君山区", "云溪区", "汨罗市", "临湘市", "岳阳县", "湘阴县", "华容县"],
        ["永定区", "武陵源区", "桑植县"],
        ["资阳区", "赫山区", "大通湖区", "沅江市", "桃江县", "南县"],
        ["武陵区", "鼎城区", "津市市", "汉寿县", "安乡县", "澧县", "临澧县", "桃源县"],
        ["娄星区", "涟源市", "冷水江市", "双峰县"],
        ["苏仙区", "北湖区", "资兴市", "安仁县", "桂阳县", "桂东县", "永兴县", "嘉禾县", "临武县", "汝城县"],
        ["零陵区", "冷水滩区", "道县", "祁阳县", "东安县", "双牌县", "江永县", "宁远县", "新田县", "江华瑶族自治县", "金洞管理区", "回龙圩管理区"],
        ["鹤城区", "洪江市", "洪江管理区", "中方县", "沅陵县", "辰溪县", "会同县", "麻阳苗族自治县", "靖州苗族侗族自治县", "新晃侗族自治县", "芷江侗族自治县", "通道侗族自治县"],
        ["吉首市", "泸溪县", "凤凰县", "花垣县", "保靖县", "古丈县", "永顺县", "龙山县"],
        ["浏阳市", "湘乡市", "耒阳市", "武冈市", "茶陵县", "平江县", "慈利县", "安化县", "石门县", "新化县", "宜章县", "蓝山县", "溆浦县"]
    ],
    /*广东省*/
    [
        ["越秀区", "荔湾区", "海珠区", "天河区", "白云区", "黄埔区", "花都区", "番禺区", "南沙区", "增城区", "从化区"],
        ["福田区", "罗湖区", "南山区", "盐田区", "宝安区", "龙岗区"],
        ["香洲区", "斗门区", "金湾区"],
        ["金平区", "龙湖区", "濠江区", "潮南区", "潮阳区", "澄海区", "南澳县"],
        ["禅城区", "高明区", "三水区", "南海区", "顺德区"],
        ["浈江区", "武江区", "曲江区", "乐昌市", "南雄市", "始兴县", "仁化县", "翁源县", "新丰县", "乳源瑶族自治县"],
        ["赤坎区", "霞山区", "坡头区", "麻章区", "廉江市", "吴川市", "雷州市", "遂溪县", "徐闻县"],
        ["端州区", "鼎湖区", "高要区", "四会市", "广宁县", "怀集县", "封开县", "德庆县"],
        ["江海区", "蓬江区", "新会区", "台山市", "鹤山市", "开平市", "恩平市"],
        ["茂南区", "电白区", "高州市", "化州市", "信宜市"],
        ["惠城区", "惠阳区", "惠东县", "博罗县", "龙门县"],
        ["梅江区", "梅县区", "兴宁市", "大埔县", "丰顺县", "五华县", "平远县", "蕉岭县"],
        ["城区", "陆丰市", "海丰县", "陆河县"],
        ["源城区", "龙川县", "连平县", "东源县", "和平县", "紫金县"],
        ["江城区", "阳东区", "阳春市", "阳西县"],
        ["清城区", "清新区", "英德市", "连州市", "佛冈县", "阳山县", "连山壮族瑶族自治县", "连南瑶族自治县"],
        ["东莞市"],
        ["中山市"],
        ["湘桥区", "潮安区", "饶平县"],
        ["榕城区", "揭东区", "普宁市", "揭西县", "惠来县"],
        ["云城区", "云安区", "罗定市", "新兴县", "郁南县"]
    ],
    /*广西壮族自治区*/
    [
        ["青秀区", "兴宁区", "西乡塘区", "江南区", "良庆区", "邕宁区", "武鸣区", "隆安县", "马山县", "上林县", "宾阳县", "横县"],
        ["柳北区", "柳南区", "城中区", "鱼峰区", "柳城县", "柳江县", "鹿寨县", "融安县", "融水苗族自治县", "三江侗族自治县"],
        ["象山区", "秀峰区", "叠彩区", "七星区", "雁山区", "临桂区", "阳朔县", "灵川县", "全州县", "平乐县", "兴安县", "灌阳县", "荔浦县", "资源县", "永福县", "龙胜各族自治县", "恭城瑶族自治县"],
        ["长洲区", "万秀区", "龙圩区", "岑溪市", "苍梧县", "蒙山县", "藤县"],
        ["海城区", "银海区", "铁山港区", "合浦县"],
        ["江州区", "凭祥市", "扶绥县", "宁明县", "龙州县", "大新县", "天等县"],
        ["兴宾区", "合山市", "象州县", "武宣县", "忻城县", "金秀瑶族自治县"],
        ["八步区", "昭平县", "钟山县", "富川瑶族自治县"],
        ["玉州区", "福绵区", "北流市", "容县", "陆川县", "博白县", "兴业县"],
        ["右江区", "靖西市", "田阳县", "田东县", "平果县", "德保县", "那坡县", "凌云县", "乐业县", "田林县", "西林县", "隆林各族自治县"],
        ["金城江区", "宜州市", "南丹县", "天峨县", "凤山县", "东兰县", "巴马瑶族自治县", "都安瑶族自治县", "大化瑶族自治县", "罗城仫佬族自治县", "环江毛南族自治县"],
        ["钦南区", "钦北区", "灵山县", "浦北县"],
        ["港口区", "防城区", "东兴市", "上思县"],
        ["港北区", "港南区", "覃塘区", "桂平市", "平南县"]
    ],
    /*海南省*/
    [
        ["秀英区", "龙华区", "琼山区", "美兰区"],
        ["崖州区", "天涯区", "吉阳区", "海棠区"],
        ["西沙群岛", "中沙群岛", "南沙群岛的岛礁及其海域"],
        ["儋州市"],
        ["五指山市", "文昌市", "琼海市", "万宁市", "东方市", "定安县", "屯昌县", "澄迈县", "临高县", "白沙黎族自治县", "昌江黎族自治县", "乐东黎族自治县", "陵水黎族自治县", "保亭黎族苗族自治县", "琼中黎族苗族自治县"]
    ],
    /*重庆市*/
    [
        ["渝北区", "渝中区", "江北区", "江津区", "南岸区", "北碚区", "巴南区", "涪陵区", "綦江区", "大足区", "长寿区", "合川区", "永川区", "南川区", "璧山区", "铜梁区", "潼南区", "荣昌区", "万州区", "黔江区", "大渡口区", "九龙坡区", "沙坪坝区"],
        ["巫山县", "巫溪县", "丰都县", "垫江县", "城口县", "云阳县", "奉节县", "武隆县", "梁平县", "开县", "忠县", "石柱土家族自治县", "彭水苗族土家族自治县", "秀山土家族苗族自治县", "酉阳土家族苗族自治县"]
    ],
    /*四川省*/
    [
        ["锦江区", "青羊区", "金牛区", "武侯区", "成华区", "青白江区", "龙泉驿区", "新都区", "温江区", "双流区", "都江堰市", "彭州市", "崇州市", "邛崃市", "简阳市", "金堂县", "郫县", "大邑县", "蒲江县", "新津县"],
        ["涪城区", "游仙区", "安州区", "江油市", "梓潼县", "三台县", "盐亭县", "平武县", "北川羌族自治县"],
        ["自流井区", "贡井区", "大安区", "沿滩区", "荣县", "富顺县"],
        ["东区", "西区", "仁和区", "米易县", "盐边县"],
        ["江阳区", "龙马潭区", "纳溪区", "泸县", "合江县", "叙永县", "古蔺县"],
        ["旌阳区", "广汉市", "什邡市", "绵竹市", "中江县", "罗江县"],
        ["利州区", "昭化区", "朝天区", "旺苍县", "青川县", "剑阁县", "苍溪县"],
        ["船山区", "安居区", "射洪县", "蓬溪县", "大英县"],
        ["市中区", "东兴区", "资中县", "隆昌县", "威远县"],
        ["市中区", "沙湾区", "五通桥区", "金口河区", "峨眉山市", "犍为县", "井研县", "夹江县", "沐川县", "峨边彝族自治县", "马边彝族自治县"],
        ["雁江区", "安岳县", "乐至县"],
        ["翠屏区", "南溪区", "宜宾县", "江安县", "长宁县", "高县", "筠连县", "珙县", "兴文县", "屏山县"],
        ["顺庆区", "高坪区", "嘉陵区", "阆中市", "西充县", "南部县", "蓬安县", "营山县", "仪陇县"],
        ["通川区", "达川区", "万源市", "宣汉县", "开江县", "大竹县", "渠县"],
        ["雨城区", "名山区", "荥经县", "汉源县", "石棉县", "天全县", "芦山县", "宝兴县"],
        ["广安区", "前锋区", "华蓥市", "邻水县", "武胜县", "岳池县"],
        ["巴州区", "恩阳区", "平昌县", "通江县", "南江县"],
        ["东坡区", "彭山区", "仁寿县", "丹棱县", "青神县", "洪雅县"],
        ["马尔康市", "金川县", "小金县", "阿坝县", "若尔盖县", "红原县", "壤塘县", "汶川县", "理县", "茂县", "松潘县", "九寨沟县", "黑水县"],
        ["康定市", "泸定县", "丹巴县", "九龙县", "雅江县", "道孚县", "炉霍县", "甘孜县", "新龙县", "德格县", "白玉县", "石渠县", "色达县", "理塘县", "巴塘县", "乡城县", "稻城县", "得荣县"],
        ["西昌市", "德昌县", "会理县", "会东县", "宁南县", "普格县", "布拖县", "昭觉县", "金阳县", "雷波县", "美姑县", "甘洛县", "越西县", "喜德县", "冕宁县", "盐源县", "木里藏族自治县"]
    ],
    /*贵州省*/
    [
        ["南明区", "云岩区", "花溪区", "乌当区", "白云区", "观山湖区", "清镇市", "开阳县", "息烽县", "修文县"],
        ["钟山区", "六枝特区", "水城县", "盘县"],
        ["红花岗区", "汇川区", "播州区", "桐梓县", "绥阳县", "正安县", "凤冈县", "湄潭县", "余庆县", "习水县", "道真仡佬族苗族自治县", "务川仡佬族苗族自治县"],
        ["西秀区", "平坝区", "普定县", "镇宁布依族苗族自治县", "关岭布依族苗族自治县", "紫云苗族布依族自治县"],
        ["七星关区", "大方县", "黔西县", "金沙县", "织金县", "纳雍县", "赫章县"],
        ["碧江区", "万山区", "江口县", "石阡县", "思南县", "德江县", "玉屏县", "松桃县", "沿河县", "印江县"],
        ["兴义市", "兴仁县", "普安县", "晴隆县", "贞丰县", "望谟县", "册亨县", "安龙县"],
        ["凯里市", "黄平县", "施秉县", "三穗县", "岑巩县", "天柱县", "锦屏县", "剑河县", "台江县", "榕江县", "从江县", "雷山县", "麻江县", "丹寨县"],
        ["都匀市", "福泉市", "荔波县", "贵定县", "瓮安县", "独山县", "平塘县", "罗甸县", "长顺县", "龙里县", "惠水县", "三都水族自治县"],
        ["仁怀市", "赤水市", "福泉市", "镇远县", "黎平县", "威宁彝族回族苗族自治县"]
    ],
    /*云南省*/
    [
        ["呈贡区", "盘龙区", "五华区", "官渡区", "西山区", "东川区", "安宁市", "晋宁县", "富民县", "宜良县", "嵩明县", "石林彝族自治县", "禄劝彝族苗族自治县", "寻甸回族彝族自治县"],
        ["昭阳区", "鲁甸县", "巧家县", "盐津县", "大关县", "永善县", "绥江县", "镇雄县", "彝良县", "威信县", "水富县"],
        ["麒麟区", "沾益区", "宣威市", "马龙县", "富源县", "罗平县", "师宗县", "陆良县", "会泽县"],
        ["红塔区", "江川区", "澄江县", "通海县", "华宁县", "易门县", "峨山彝族自治县", "新平彝族傣族自治县", "元江哈尼族彝族傣族自治县"],
        ["思茅区", "宁洱哈尼族彝族自治县", "墨江哈尼族自治县", "景东彝族自治县", "景谷傣族彝族自治县", "镇沅彝族哈尼族拉祜族自治县", "江城哈尼族彝族自治县", "孟连傣族拉祜族佤族自治县", "澜沧拉祜族自治县", "西盟佤族自治县"],
        ["隆阳区", "腾冲市", "施甸县", "龙陵县", "昌宁县"],
        ["古城区", "永胜县", "华坪县", "玉龙纳西族自治县", "宁蒗彝族自治县"],
        ["临翔区", "凤庆县", "云县", "永德县", "镇康县", "双江拉祜族佤族布朗族傣族自治县", "耿马傣族佤族自治县", "沧源佤族自治县"],
        ["楚雄市", "双柏县", "牟定县", "南华县", "姚安县", "大姚县", "永仁县", "元谋县", "武定县", "禄丰县"],
        ["蒙自市", "个旧市", "开远市", "弥勒市", "建水县", "石屏县", "泸西县", "绿春县", "元阳县", "红河县", "金平苗族瑶族傣族自治县", "河口瑶族自治县", "屏边苗族自治县"],
        ["文山市", "砚山县", "西畴县", "麻栗坡县", "马关县", "丘北县", "广南县", "富宁县"],
        ["景洪市", "勐海县", "勐腊县"],
        ["大理市", "祥云县", "宾川县", "弥渡县", "永平县", "云龙县", "洱源县", "剑川县", "鹤庆县", "漾濞彝族自治县", "南涧彝族自治县", "巍山彝族回族自治县"],
        ["芒市", "瑞丽市", "梁河县", "盈江县", "陇川县"],
        ["泸水县", "福贡县", "贡山独龙族怒族自治县", "兰坪白族普米族自治县"],
        ["香格里拉市", "德钦县", "维西傈僳族自治县"]
    ],
    /*西藏自治区*/
    [
        ["城关区", "堆龙德庆区", "林周县", "达孜县", "尼木县", "当雄县", "曲水县", "墨竹工卡县"],
        ["卡若区", "察雅县", "左贡县", "芒康县", "洛隆县", "边坝县", "江达县", "贡觉县", "丁青县", "八宿县", "类乌齐县"],
        ["桑珠孜区", "南木林县", "江孜县", "定日县", "萨迦县", "拉孜县", "昂仁县", "谢通门县", "白朗县", "仁布县", "康马县", "定结县", "仲巴县", "亚东县", "吉隆县", "聂拉木县", "萨嘎县", "岗巴县"],
        ["巴宜区", "工布江达县", "波密县", "朗县", "米林县", "察隅县", "墨脱县"],
        ["乃东区", "扎囊县", "贡嘎县", "桑日县", "琼结县", "洛扎县", "加查县", "隆子县", "曲松县", "措美县", "错那县", "浪卡子县"],
        ["那曲县", "申扎县", "班戈县", "聂荣县", "安多县", "嘉黎县", "巴青县", "比如县", "索县", "尼玛县"],
        ["噶尔县", "普兰县", "札达县", "日土县", "革吉县", "改则县", "措勤县"]
    ],
    /*陕西省*/
    [
        ["新城区", "碑林区", "莲湖区", "灞桥区", "未央区", "雁塔区", "阎良区", "临潼区", "长安区", "高陵区", "蓝田县", "周至县", "户县"],
        ["耀州区", "王益区", "印台区", "宜君县"],
        ["渭滨区", "金台区", "陈仓区", "凤翔县", "岐山县", "扶风县", "眉县", "陇县", "千阳县", "麟游县", "凤县", "太白县"],
        ["秦都区", "渭城区", "兴平市", "三原县", "泾阳县", "武功县", "乾县", "礼泉县", "永寿县", "彬县", "长武县", "旬邑县", "淳化县"],
        ["临渭区", "华州区", "华阴市", "蒲城县", "富平县", "潼关县", "大荔县", "合阳县", "澄城县", "白水县"],
        ["汉台区", "南郑县", "城固县", "洋县", "西乡县", "勉县", "宁强县", "略阳县", "镇巴县", "留坝县", "佛坪县"],
        ["汉滨区", "旬阳县", "石泉县", "平利县", "汉阴县", "宁陕县", "紫阳县", "岚皋县", "镇坪县", "白河县"],
        ["商州区", "洛南县", "丹凤县", "商南县", "山阳县", "镇安县", "柞水县"],
        ["宝塔区", "延长县", "延川县", "子长县", "安塞县", "志丹县", "吴起县", "甘泉县", "富县", "洛川县", "宜川县", "黄龙县", "黄陵县"],
        ["榆阳区", "横山区", "靖边县", "定边县", "绥德县", "米脂县", "佳县", "吴堡县", "清涧县", "子洲县"],
        ["杨陵区"],
        ["韩城市", "神木县", "府谷县"]
    ],
    /*甘肃省*/
    [
        ["城关区", "七里河区", "西固区", "安宁区", "红古区", "榆中县", "皋兰县", "永登县"],
        ["嘉峪关市"],
        ["金川区", "永昌县"],
        ["白银区", "平川区", "会宁县", "靖远县", "景泰县"],
        ["秦州区", "麦积区", "清水县", "秦安县", "甘谷县", "武山县", "张家川回族自治县"],
        ["肃州区", "玉门市", "敦煌市", "瓜州县", "金塔县", "肃北蒙古族自治县", "阿克塞哈萨克族自治县"],
        ["甘州区", "山丹县", "民乐县", "临泽县", "高台县", "肃南裕固族自治县"],
        ["凉州区", "古浪县", "民勤县", "天祝藏族自治县"],
        ["安定区", "通渭县", "陇西县", "漳县", "渭源县", "岷县", "临洮县"],
        ["武都区", "宕昌县", "两当县", "徽县", "成县", "西和县", "礼县", "康县", "文县"],
        ["崆峒区", "泾川县", "灵台县", "崇信县", "华亭县", "庄浪县", "静宁县"],
        ["西峰区", "正宁县", "华池县", "合水县", "宁县", "庆城县", "镇原县", "环县"],
        ["临夏市", "临夏县", "康乐县", "广河县", "永靖县", "和政县", "东乡族自治县", "积石山保安族东乡族撒拉族自治县"],
        ["合作市", "夏河县", "玛曲县", "舟曲县", "碌曲县", "迭部县", "临潭县", "卓尼县"]
    ],
    /*青海省*/
    [
        ["城中区", "城东区", "城西区", "城北区", "湟中县", "湟源县", "大通回族土族自治县"],
        ["乐都区", "平安区", "民和回族土族自治县", "互助土族自治县", "化隆回族自治县", "循化撒拉族自治县"],
        ["海晏县", "祁连县", "刚察县", "门源回族自治县"],
        ["共和县", "同德县", "贵德县", "贵南县", "兴海县"],
        ["德令哈市", "格尔木市", "天峻县", "都兰县", "乌兰县"],
        ["同仁县", "尖扎县", "泽库县", "河南蒙古族自治县"],
        ["玛沁县", "班玛县", "甘德县", "达日县", "久治县", "玛多县"],
        ["玉树市", "杂多县", "称多县", "治多县", "囊谦县", "曲麻莱县"]
    ],
    /*宁夏回族自治区*/
    [
        ["兴庆区", "金凤区", "西夏区", "灵武市", "永宁县", "贺兰县"],
        ["大武口区", "惠农区", "平罗县"],
        ["利通区", "红寺堡区", "青铜峡市"],
        ["原州区", "西吉县", "隆德县", "泾源县", "彭阳县"],
        ["沙坡头区", "中宁县", "海原县"],
        ["同心县", "盐池县"]
    ],
    /*新疆维吾尔自治区*/
    [
        ["天山区", "沙依巴克区", "新市区", "水磨沟区", "头屯河区", "达坂城区", "米东区", "乌鲁木齐县"],
        ["独山子区", "克拉玛依区", "白碱滩区", "乌尔禾区"],
        ["高昌区", "鄯善县", "托克逊县"],
        ["伊州区", "伊吾县", "巴里坤哈萨克自治县"],
        ["阿克苏市", "温宿县", "库车县", "沙雅县", "新和县", "拜城县", "乌什县", "阿瓦提县", "柯坪县"],
        ["喀什市", "疏附县", "疏勒县", "英吉沙县", "泽普县", "莎车县", "叶城县", "麦盖提县", "岳普湖县", "伽师县", "巴楚县", "塔什库尔干塔吉克自治县"],
        ["和田市", "和田县", "墨玉县", "皮山县", "洛浦县", "策勒县", "于田县", "民丰县"],
        ["伊宁市", "奎屯市", "霍尔果斯市", "尼勒克县", "伊宁县", "霍城县", "巩留县", "新源县", "昭苏县", "特克斯县", "察布查尔锡伯自治县", "塔城地区", "阿勒泰地区"],
        ["昌吉市", "阜康市", "呼图壁县", "玛纳斯县", "奇台县", "吉木萨尔县", "木垒哈萨克自治县"],
        ["博乐市", "阿拉山口市", "精河县", "温泉县"],
        ["库尔勒市", "轮台县", "尉犁县", "若羌县", "且末县", "和静县", "和硕县", "博湖县", "焉耆回族自治县"],
        ["阿图什市", "阿克陶县", "阿合奇县", "乌恰县"],
        ["石河子市", "阿拉尔市", "图木舒克市", "五家渠市", "北屯市", "铁门关市", "双河市", "可克达拉市", "昆玉市"]
    ],
    /*台湾省*/
    [
        ["中正区", "大同区", "中山区", "松山区", "大安区", "万华区", "信义区", "士林区", "北投区", "内湖区", "南港区", "文山区"],
        ["板桥区", "汐止区", "新店区", "永和区", "中和区", "土城区", "树林区", "三重区", "新庄区", "芦洲区", "瑞芳区", "三峡区", "莺歌区", "淡水区", "万里区", "金山区", "深坑区", "石碇区", "平溪区", "双溪区", "贡寮区", "坪林区", "乌来区", "泰山区", "林口区", "五股区", "八里区", "三芝区", "石门区"],
        ["桃园区", "中坜区", "平镇区", "八德区", "杨梅区", "芦竹区", "大溪区", "龙潭区", "龟山区", "大园区", "观音区", "新屋区", "复兴区"],
        ["中区", "东区", "南区", "西区", "北区", "北屯区", "西屯区", "南屯区", "太平区", "大里区", "雾峰区", "乌日区", "丰原区", "后里区", "潭子区", "大雅区", "神冈区", "石冈区", "东势区", "新社区", "和平区", "大肚区", "沙鹿区", "龙井区", "梧栖区", "清水区", "大甲区", "外埔区", "大安区"],
        ["中西区", "东区", "南区", "北区", "安平区", "安南区", "永康区", "归仁区", "新化区", "左镇区", "玉井区", "楠西区", "南化区", "仁德区", "关庙区", "龙崎区", "官田区", "麻豆区", "佳里区", "西港区", "七股区", "将军区", "学甲区", "北门区", "新营区", "后壁区", "白河区", "东山区", "六甲区", "下营区", "柳营区", "盐水区", "善化区", "大内区", "山上区", "新市区", "安定区"],
        ["楠梓区", "左营区", "鼓山区", "三民区", "盐埕区", "前金区", "新兴区", "苓雅区", "前镇区", "旗津区", "小港区", "凤山区", "大寮区", "鸟松区", "林园区", "仁武区", "大树区", "大社区", "冈山区", "路竹区", "桥头区", "梓官区", "弥陀区", "永安区", "燕巢区", "阿莲区", "茄萣区", "湖内区", "旗山区", "美浓区", "内门区", "杉林区", "甲仙区", "六龟区", "茂林区", "桃源区", "那玛夏区"],
        ["中正区", "中山区", "七堵区", "暖暖区", "仁爱区", "安乐区", "信义区"],
        ["东区", "北区", "香山区"],
        ["东区", "西区"],
        ["新竹县", "苗栗县", "彰化县", "南投县", "云林县", "嘉义县", "屏东县", "宜兰县", "花莲县", "台东县", "澎湖县", "金门县", "连江县"],
        ["钓鱼岛", "南小岛", "北小岛", "赤尾屿", "黄尾屿", "北屿", "南屿", "飞濑岛"]
    ],
    /*香港特别行政区*/
    [
        ["中西区", "湾仔区", "东区", "南区"],
        ["油尖旺区", "深水埗区", "九龙城区", "黄大仙区", "观塘区"],
        ["北区", "大埔区", "沙田区", "西贡区", "荃湾区", "屯门区", "元朗区", "葵青区", "离岛区"]
    ],
    /*澳门特别行政区*/
    [
        ["花地玛堂区", "圣安多尼堂区", "大堂区", "望德堂区", "风顺堂区"],
        ["嘉模堂区", "圣方济各堂区"],
        ["路氹城"]
    ]
];
var provincestr = "",citystr = "",districtstr = "";
for(var i = 0;i<province.length;i++){
    provincestr +='<option data_province="'+i+'" value="'+province[i]+'">'+province[i]+'</option>'
}
$('.province').html(provincestr);
$('.province').change(function(){
    var unm = $(this).find("option:selected").attr('data_province');
    citylian(unm);
    districtlian(unm,"0");
});
citylian("0");
function citylian(x){
    citystr = ""
    $('.city').html("");
    for(var i = 0;i<city[x].length;i++){
        citystr +='<option data_province="'+x+'" data_city="'+i+'" value="'+city[x][i]+'">'+city[x][i]+'</option>'
    }
    $('.city').html(citystr);
    $('.city').change(function(){
        var unm1 = $(this).find("option:selected").attr('data_province');
        var unm2 = $(this).find("option:selected").attr('data_city');
        districtlian(unm1,unm2);
    });
}
districtlian("0","0");
function districtlian(x,y){
    districtstr = ""
    $('.district').html("");
    for(var i = 0;i<district[x][y].length;i++){
        districtstr +='<option value="'+district[x][y][i]+'">'+district[x][y][i]+'</option>'
    }
    $('.district').html(districtstr);
}
!function(a){"use strict";a.fn.circleChart=function(b){const c={color:"#3459eb",backgroundColor:"#e6e6e6",background:!0,speed:2e3,widthRatio:.2,value:66,unit:"percent",counterclockwise:!1,size:110,startAngle:0,animate:!0,backgroundFix:!0,lineCap:"round",animation:"easeInOutCubic",text:!1,redraw:!1,cAngle:0,textCenter:!0,textSize:!1,textWeight:"normal",textFamily:"sans-serif",relativeTextSize:1/7,autoCss:!0,onDraw:!1};Math.linearTween=((a,b,c,d)=>c*a/d+b),Math.easeInQuad=((a,b,c,d)=>{a/=d;return c*a*a+b}),Math.easeOutQuad=((a,b,c,d)=>{a/=d;return-c*a*(a-2)+b}),Math.easeInOutQuad=((a,b,c,d)=>{a/=d/2;if(a<1)return c/2*a*a+b;a--;return-c/2*(a*(a-2)-1)+b}),Math.easeInCubic=((a,b,c,d)=>{a/=d;return c*a*a*a+b}),Math.easeOutCubic=((a,b,c,d)=>{a/=d;a--;return c*(a*a*a+1)+b}),Math.easeInOutCubic=((a,b,c,d)=>{a/=d/2;if(a<1)return c/2*a*a*a+b;a-=2;return c/2*(a*a*a+2)+b}),Math.easeInQuart=((a,b,c,d)=>{a/=d;return c*a*a*a*a+b}),Math.easeOutQuart=((a,b,c,d)=>{a/=d;a--;return-c*(a*a*a*a-1)+b}),Math.easeInOutQuart=((a,b,c,d)=>{a/=d/2;if(a<1)return c/2*a*a*a*a+b;a-=2;return-c/2*(a*a*a*a-2)+b}),Math.easeInQuint=((a,b,c,d)=>{a/=d;return c*a*a*a*a*a+b}),Math.easeOutQuint=((a,b,c,d)=>{a/=d;a--;return c*(a*a*a*a*a+1)+b}),Math.easeInOutQuint=((a,b,c,d)=>{a/=d/2;if(a<1)return c/2*a*a*a*a*a+b;a-=2;return c/2*(a*a*a*a*a+2)+b}),Math.easeInSine=((a,b,c,d)=>-c*Math.cos(a/d*(Math.PI/2))+c+b),Math.easeOutSine=((a,b,c,d)=>c*Math.sin(a/d*(Math.PI/2))+b),Math.easeInOutSine=((a,b,c,d)=>-c/2*(Math.cos(Math.PI*a/d)-1)+b),Math.easeInExpo=((a,b,c,d)=>c*Math.pow(2,10*(a/d-1))+b),Math.easeOutExpo=((a,b,c,d)=>c*(1-Math.pow(2,-10*a/d))+b),Math.easeInOutExpo=((a,b,c,d)=>{a/=d/2;if(a<1)return c/2*Math.pow(2,10*(a-1))+b;a--;return c/2*(2-Math.pow(2,-10*a))+b}),Math.easeInCirc=((a,b,c,d)=>{a/=d;return-c*(Math.sqrt(1-a*a)-1)+b}),Math.easeOutCubic=((a,b,c,d)=>{a/=d;a--;return c*(a*a*a+1)+b}),Math.easeInOutCubic=((a,b,c,d)=>{a/=d/2;if(a<1)return c/2*a*a*a+b;a-=2;return c/2*(a*a*a+2)+b}),Math.easeOutCirc=((a,b,c,d)=>{a/=d;a--;return c*Math.sqrt(1-a*a)+b}),Math.easeInOutCirc=((a,b,c,d)=>{a/=d/2;if(a<1)return-c/2*(Math.sqrt(1-a*a)-1)+b;a-=2;return c/2*(Math.sqrt(1-a*a)+1)+b});let d=(a,b,c,e,f,g,h,i)=>{let j=Object.create(d.prototype);j.pos=a;j.bAngle=b;j.eAngle=c;j.cAngle=e;j.radius=f;j.lineWidth=g;j.sAngle=h;j.settings=i;return j};d.prototype={onDraw(a){if(!1!==this.settings.onDraw){let c=Object.assign({},this);var b={percent:i,rad:a=>a,default:f};c.value=(b[this.settings.unit]||b.default)(c.cAngle),c.text=(b=>e(a,b)),c.settings.onDraw(a,c)}},drawBackground(a){a.beginPath(),a.arc(this.pos,this.pos,this.settings.backgroundFix?.9999*this.radius:this.radius,0,2*Math.PI),a.lineWidth=this.settings.backgroundFix?.95*this.lineWidth:this.lineWidth,a.strokeStyle=this.settings.backgroundColor,a.stroke()},draw(a){if(a.beginPath(),this.settings.counterclockwise){let b=2*Math.PI;a.arc(this.pos,this.pos,this.radius,b-this.bAngle,b-(this.bAngle+this.cAngle),this.settings.counterclockwise)}else a.arc(this.pos,this.pos,this.radius,this.bAngle,this.bAngle+this.cAngle,this.settings.counterclockwise);a.lineWidth=this.lineWidth,a.lineCap=this.settings.lineCap,a.strokeStyle=this.settings.color,a.stroke()},animate(a,b,c,d,e){let f=(new Date).getTime()-c;f<1&&(f=1),c-d<1.05*this.settings.speed&&(!e&&1e3*this.cAngle<=Math.floor(1e3*this.eAngle)||e&&1e3*this.cAngle>=Math.floor(1e3*this.eAngle))?(this.cAngle=Math[this.settings.animation]((c-d)/f,this.sAngle,this.eAngle-this.sAngle,this.settings.speed/f),b.clearRect(0,0,this.settings.size,this.settings.size),this.settings.background&&this.drawBackground(b),this.draw(b),this.onDraw(a),c=(new Date).getTime(),j(()=>this.animate(a,b,c,d,e))):(this.cAngle=this.eAngle,b.clearRect(0,0,this.settings.size,this.settings.size),this.settings.background&&this.drawBackground(b),this.draw(b),this.setCurrentAnglesData(a))},setCurrentAnglesData(a){var b={percent:i,rad:a=>a,default:f};let c=b[this.settings.unit]||b.default;a.data("current-c-angle",c(this.cAngle)),a.data("current-start-angle",c(this.bAngle))}};let e=(b,c)=>{b.data("text",c);a(".circleChart_text",b).html(c)},f=a=>a/Math.PI*180,g=a=>a/180*Math.PI,h=a=>g(a/100*360),i=a=>f(a)/360*100,j=(a=>window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(b){window.setTimeout(a,1e3/60)})();return this.each((e,f)=>{let i=a(f);var k={};var l=i.data();for(let a in l)l.hasOwnProperty(a)&&0===a.indexOf("_cache_")&&c.hasOwnProperty(a.substring(7))&&(k[a.substring(7)]=l[a]);let m=Object.assign({},c,k,l,b);for(let a in m)0!==a.indexOf("_cache_")&&i.data("_cache_"+a,m[a]);a("canvas.circleChart_canvas",i).length||i.append(function(){return a("<canvas/>",{class:"circleChart_canvas"}).prop({width:m.size,height:m.size}).css(m.autoCss?{"margin-left":"auto","margin-right":"auto",display:"block"}:{})});a("p.circleChart_text",i).length||!1!==m.text&&(i.append("<p class='circleChart_text'>"+m.text+"</p>"),m.autoCss&&(m.textCenter?a("p.circleChart_text",i).css({position:"absolute","line-height":m.size+"px",top:0,width:"100%",margin:0,padding:0,"text-align":"center","font-size":!1!==m.textSize?m.textSize:m.size*m.relativeTextSize,"font-weight":m.textWeight,"font-family":m.textFamily}):a("p.circleChart_text",i).css({"padding-top":"5px","text-align":"center","font-weight":m.textWeight,"font-family":m.textFamily,"font-size":!1!==m.textSize?m.textSize:m.size*m.relativeTextSize})));m.autoCss&&i.css("position","relative");m.redraw||(m.cAngle=m.currentCAngle?m.currentCAngle:m.cAngle,m.startAngle=m.currentStartAngle?m.currentStartAngle:m.startAngle);var n=a("canvas",i).get(0);var o=n.getContext("2d");var p={percent:h,rad:a=>a,default:g};let q=p[m.unit]||p.default;let r=q(m.startAngle);let s=q(m.value);let t=q(m.cAngle);var u=m.size/2;var v=u*(1-m.widthRatio/2);var w=v*m.widthRatio;var x=d(u,r,s,t,v,w,t,m);i.data("size",m.size);m.animate?0!==m.value?x.animate(i,o,(new Date).getTime(),(new Date).getTime(),t>s):j(()=>{o.clearRect(0,0,this.settings.size,this.settings.size);x.settings.background&&x.drawBackground(o)}):(x.cAngle=x.eAngle,j(()=>{m.background&&x.drawBackground(o);0!==m.value?(x.draw(o),x.onDraw(i),x.setCurrentAnglesData(i)):(o.clearRect(0,0,this.settings.size,this.settings.size),x.settings.background&&x.drawBackground(o))}))})}}(jQuery);


//元素
function networking(){
    this.popTotal = $('.pop_total');                 //扣币（弹窗）
    this.cancel = $('.pop_total .cancel');           //弹窗取消按钮
    this.sure = $('.pop_total .sure');           //弹窗确认按钮
};

//砸金蛋首页
networking.prototype.goldenegg = function () {
    // window.location.reload();
    var _this = this;
    let egg_id = '';
    let egg_money = '';
    ajaxEve('POST', server.goldeggIndex, {type:1}, function (result) {
            console.log(result)
            if(result.status == 200){
                var dov = $('.smashgoldeggs_mian');
                var dataInfo = result.data;
                var dovbooy = $('#smashgoldeggs_mian');
                jo.reTpl(dovbooy, dataInfo, dov);
                seruer();
            };
        },
        function (result) {
            layer.open({
                content: result.msg,skin: 'msg',time: 2
            });
            return;
        });


    function seruer(){
        //弹窗赋值（需要扣除的clw）
        $('.smashgoldeggs_list').click(function(){
            egg_id = $(this).attr("data-id");
            egg_money = $(this).attr("data-money");
            // $('.money').html(egg_money);
            // _this.popTotal.show();
            layer.open({
                className: 'popuo-login',
                content:'<p>参与'+ egg_money + '币砸金蛋将扣除参与费' + egg_money + 'CLW</p>',
                shadeClose:false,   //点击遮罩层是否关闭弹窗
                btn: ['进入游戏', '取消'],
                yes: function(){
                    window.location.href = "zjdpage.html?egg_id="+egg_id+'&egg_money='+egg_money;
                    // $(location).attr('href', 'zjdpage.html?egg_id=' + egg_id + '&egg_money=' + egg_money);
                }
            });
        });
    }
    //弹窗取消按钮
    // _this.cancel.on('click', function(){
    //     _this.popTotal.hide();
    // });
    //弹窗确认按钮
    // $('.pop_down').on('click','.sure',function () {
    //     $(location).attr('href', 'zjdpage.html?egg_id=' + egg_id + '&egg_money=' + egg_money);
    // });

};

//砸金蛋页面
networking.prototype.zjdpage = function (){
    $(function () {
            var egg_id = GetQueryString('egg_id');
            var egg_money = GetQueryString('egg_money');
            var assetsPath = "images/";
            manifest = [
                {id: "img01", src: "agg.png"},
                {id: "img02", src: "agg-puo.png"},
                {id: "img03", src: "hammer.png"}
            ];
            createjs.Sound.alternateExtensions = ["mp3"];
            preload = new createjs.LoadQueue(true, assetsPath);
            preload.installPlugin(createjs.Sound);
            preload.addEventListener("complete", doneLoading);
            preload.addEventListener("progress", updateLoading);
            preload.loadManifest(manifest);
            function updateLoading() {
                $("#loadtext").text("Loading " + (preload.progress * 100 | 0) + "%");
            }
            //loading完毕
            function doneLoading(event) {
                //createjs.Sound.play("laser");
                $("#loading").hide();
                // start 播放背景音乐
                // createjs.Sound.play("bgMusic", {interrupt: createjs.Sound.INTERRUPT_NONE, loop: -1, volume: 0.4});
            }

            //点击蛋蛋
            function aClick() {

                $(".agg").off("click", aClick);
                for (var i = 0; i < $('.agg').length; i++) { //清除原来的动画类名
                    $('.agg').eq(i).removeClass('move'+i);
                }
                var _this = $(this);



                // setTimeout(function () {
                //     createjs.Sound.play("bgMusic", {interrupt: createjs.Sound.INTERRUPT_NONE});
                //     _this.css({background:"none"}).find(".agg-puo").show();
                //     $(".pop_total").css({'display':"block"});
                // },250);


                ajaxEve('POST', server.open_egg, {type:1,money:egg_id}, function (result) {
                    console.log(result);
                        if(result.status==200){
                            var  getMonney = result.data;
                            $('.p1 span').html(egg_money);
                            $('.p2 span').html(getMonney);
                            _this.html('<img src="images/hammer.png" class="hammer"><img src="images/agg-puo.png" class="agg-puo">');
                            setTimeout(function () {
                                createjs.Sound.play("bgMusic", {interrupt: createjs.Sound.INTERRUPT_NONE});
                                _this.css({background:"none"}).find(".agg-puo").show();
                                $(".pop_total").css({'display':"block"});
                                $(".stage").css({'display':"none"});
                            },250);
                            $("#start-again").css('display','block');
                        }
                    },
                    function (result) {
                        layer.open({
                            content: result.msg,skin: 'msg',time: 2
                        });
                        return;
                        window.location.reload();
                        // $(".pop_total").css('display','none');
                    });


            }
            $(".agg").on("click", aClick);

    });
    //砸蛋之后的弹窗消失
    var _this = this;
    $('.pop_total').on('click','.pop_up', function(){
        _this.popTotal.hide();
        $(".stage").css({'display':"block"});
    });
    //再来一次的按钮
    $('#start-again').on('click','span', function(){
        window.location.reload();
    });
};

//砸金蛋参与记录
networking.prototype.zjdhistory = function (){

    var page=1,size=1,datas=null,status=true;
    var dovList = $('.pdrecords_list');
    var dovbooyList = $('#pdrecords_list');
    //
    $.ajax({
        url:server.egg_history,
        type:'post',
        data:{page:page},
        beforeSend: function(request) {
            request.setRequestHeader("account",accontdata);
            request.setRequestHeader("token",tokendata);
        },
        success:function(data){
            console.log(data)
            if(data.status == 200){
                datas=data.data;
                jo.reTpl(dovbooyList,datas,dovList);
                $('.pull-down').hide();
            }
        },
        error:function(data){

        }
    });
    window.onscroll=function(){
        var allHeight=document.body.offsetHeight||document.documentElement.offsetHeight;
        var scrollHeight=document.documentElement.scrollTop || document.body.scrollTop;
        var curHeight=document.documentElement.clientHeight;
        var cha=allHeight-scrollHeight-curHeight;
        if(cha<60){
            if(status){
                status=false;
                page+=1;
                $.ajax({
                    url:server.egg_history,
                    type:'post',
                    data:{page:page},
                    beforeSend: function(request) {
                        request.setRequestHeader("account",accontdata);
                        request.setRequestHeader("token",tokendata);
                    },
                    success:function(data){
                        if(data.status == 200){
                            if(data.data.res.length>0){
                                for(var i=0;i<data.data.res.length;i++){

                                    datas.res.push(data.data.res[i]);
                                }
                                jo.reTpl(dovbooyList,datas,dovList);
                                status=true;
                            }else{
                                status = false;
                                $('.pull-down').html('暂无更多记录');
                            }
                        }
                    },
                    error:function(data){

                    }
                });
            }
        }
    }



};

networking.prototype.hk_agreement = function (argument) {
  var _this = this;
  agreement();
  function agreement() {
    layer.open({ type: 2, shadeClose: false });
    ajaxEve('post', server.get_agreement, { }, function (data) {    //身份认证
        layer.closeAll();
        if (data.status == 200) {
          $(".agreement_info").html(data.list.info)
        }
    }, function (data) {
        layerOpen1(data.msg);
        return;
    });
}
}
networking.prototype.hk_cashWithdrawal = function (argument) {
    var _this = this;
    cashWithdrawal_page();
    function cashWithdrawal_page() {
        layer.open({type: 2 ,shadeClose:false});
        ajaxEve('post', server.users_cash_edit, {}, function (data) {    //商品列表
            layer.closeAll();
            if (data.status == 200) {
 
                $(".balance").html(data.list.cash_money);
                $('.explain p').html(data.list.cash_message);
                if(data.list.bank_user_name != ''){
                    $(".bank_user_name").val(data.list.bank_user_name);
                }else{
                    $(".bank_user_name").val('');
                }

                if(data.list.bank_type != ''){
                    $(".bank_type").val(data.list.bank_type);
                }else{
                    $(".bank_type").val('');
                }

                if(data.list.bank_open != ''){
                    $(".bank_open").val(data.list.bank_open);
                }else{
                    $(".bank_open").val('');
                }

                
                if(data.list.bank_card != ''){
                    $(".bank_card").val(data.list.bank_card);
                }else{
                    $(".bank_card").val('');
                }


                if(data.list.is_auth == '4'){
                    $("#cash_btn").show();
                    $("#real_name").hide();
                }else{
                    $("#cash_btn").hide();
                    $("#real_name").show();
                }
                

            }
        }, function (data) {
            layerOpen1(data.msg);
            return;
        });
    }

    //前往实名认证
    $("#real_name").click(function(){
        self.location.href = "realAuthentication.html";
    })


    //提现
    $("#cash_btn").click(function () {
        // console.log(123456)
        _this.money_carry = $('.money_carry').val();         //钱
        _this.bank_user_name = $('.bank_user_name').val();   //姓名
        _this.bank_type = $('.bank_type').val();             //银行卡类型
        _this.bank_open = $('.bank_open').val();             //开户行
        _this.bank_card = $('.bank_card').val();             //银行卡号


        if(_this.money_carry == '0.00'){
            layerOpen1('请输入提现金额');
            return false;
        }
        if(!_this.money(_this.money_carry)){
            layerOpen1('请输入可提现金额');
            return false;
        }


        if (!_this.isRename(_this.bank_user_name)) {
            layerOpen1('请输入真实姓名');
            return false;
        };

        if (_this.bank_type == '') {
            layerOpen1('请输入银行卡类型');
            return false;
        };

        if (_this.bank_open == '') {
            layerOpen1('请输入开户行');
            return false;
        };

        if (_this.bank_card == '') {
            layerOpen1('请输入银行卡号');
            return false;
        };

        _this.cashsave_Data = {
            'cash_money':_this.money_carry,
            'bank_user_name':_this.bank_user_name,
            'bank_type':_this.bank_type,
            'bank_open':_this.bank_open,
            'bank_card':_this.bank_card,
        };
        layer.open({ type: 2, shadeClose: false });
        ajaxEve('post', server.users_cash_save, _this.cashsave_Data , function (data) {    //商品列表
            layer.closeAll();
            if (data.status == 200) {
                layerOpen1(data.msg);
                // window.location.reload();
                history.go(-1);
                // window.setTimeout(function(){
                // self.location.href = "realAuthentication.html";
                // },2000);
            }
        }, function (data) {
            layerOpen1(data.msg);
            return;
        });



    })
}
networking.prototype.hk_goodsDetails = function (argument) {
  var _this = this;

  


  var first_uid = GetQueryString('first_uid');  //1，21
  var goods_id = GetQueryString('goods_id');   //21

  if(!goods_id){
    var arr = first_uid.split(',');
    first_uid = arr[0];
    goods_id = arr[1];
  }

  index_authorization(first_uid,goods_id);



  


  //订单查询
  $(".order_query").click(function () {
    self.location.href = "orderQuery.html";
  })
  //订单查询
  $(".collect_immediately").click(function () {
    self.location.href = "informationCompletion.html?goods_id=" + goods_id;
  })

  function index_shop(goods_id){
    layer.open({ type: 2, shadeClose: false });
    ajaxEve('post', server.details, { goods_id: goods_id }, function (data) {    //商品详情
      layer.closeAll();
      if (data.status == 200) {
        var detail_img = 'http://www.9f502.com/' + data.list.detail;
        $(".goods_img img").attr('src', detail_img);
      }
    }, function (data) {
      layerOpen1(data.msg);
      return;
    });
  }




  function index_authorization(first_uid , goods_id) {
    var token = window.sessionStorage.getItem("token");

    console.log(first_uid);
    console.log(goods_id);

    var codeData_1 = first_uid + ',' + goods_id;

    if(token){
      index_shop(goods_id);
    }else{
        var code = GetQueryString('code');
        var codeData = {
            code:code,
            pid:first_uid
        }
        if(code){
            $.ajax({
                url: server.login_wx,
                type:'post',
                data: codeData ,
                dataType: "json",
                success(data){
                    if (data.status == 201) {
                        window.location.href = 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxc31bdf2ce95010be&redirect_uri=http://www.9f502.com/h5/goodsDetails.html?first_uid='+codeData_1+'&response_type=code&scope=snsapi_userinfo&state=1#wechat_redirect'
                    } 
                    if (data.status == 200) {
                        sessionStorage.setItem("token", data.token);
                        sessionStorage.setItem("account", data.account);
                        index_shop(goods_id);
                    }
                }
            })
        }else{
            window.location.href = 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxc31bdf2ce95010be&redirect_uri=http://www.9f502.com/h5/goodsDetails.html?first_uid='+codeData_1+'&response_type=code&scope=snsapi_userinfo&state=1#wechat_redirect'
        }
    }
}



}

networking.prototype.hk_index = function (argument) {
    var _this = this;
    _this.Type = '0';  //0是全部,1是移动，2是联通，3是电信;
    var first_uid = GetQueryString('first_uid');



    index_login(first_uid);

    // tab切换
    $('.index_tab li').click(function () {
        $(this).attr("class", "choice");
        $(this).siblings().attr("class", "");
        _this.Type = $(this).attr('data-type');
        index_Data();
    })

    //获取商品详情
    $(".index_list").delegate("li", "click", function () {
        _this.goods_id = $(this).attr('data-id');
        self.location.href = "goodsDetails.html?goods_id=" + _this.goods_id;
    });


    $('.extension_btn').click(function () {
        self.location.href = "pushcard.html";
    })

    //首页接口
    function index_Data() {
        _this.in_Data = {
            'type': _this.Type,
            'page': 1,
            'size': 100
        };
        layer.open({ type: 2, shadeClose: false });
        ajaxEve('post', server.goods_list, _this.in_Data, function (data) {    //商品列表
            var index_list = $(".index_list");
            var indexbodyList = $("#index_list");

            layer.closeAll();
            if (data.status == 200) {
                // console.log(data);
                jo.reTpl(indexbodyList, { data: data.list.goods_list }, index_list);
            }
        }, function (data) {
            layerOpen1(data.msg);
            return;
        });
    }




    function index_login(first_uid) {
        var token = window.sessionStorage.getItem("token");
        if(token){
            index_Data();
        }else{
            var code = GetQueryString('code');
            var codeData = {
                code:code,
                pid:first_uid
            }
            if(code){
                $.ajax({
                    url: server.login_wx,
                    type:'post',
                    data: codeData ,
                    dataType: "json",
                    success(data){
                        if (data.status == 201) {
                            window.location.href = 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxc31bdf2ce95010be&redirect_uri=http://www.9f502.com/h5?first_uid='+ first_uid +'&response_type=code&scope=snsapi_userinfo&state=1#wechat_redirect'
                        } 
                        if (data.status == 200) {
                            sessionStorage.setItem("token", data.token);
                            sessionStorage.setItem("account", data.account);
                            index_Data();
                        }
                    }
                })
            }else{
                window.location.href = 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxc31bdf2ce95010be&redirect_uri=http://www.9f502.com/h5?first_uid='+ first_uid +'&response_type=code&scope=snsapi_userinfo&state=1#wechat_redirect'
            }
        }
    }

}

networking.prototype.hk_informationCompletion = function (argument) {
    var _this = this;

    var imgurl1, imgurl2, imgurl3, uploader1, uploader2, uploader3;

    var goods_id = GetQueryString('goods_id');


    $("#demo2").val('');
    $("#demo3").val('');

    order_info(goods_id);   //订单信息

    //订单信息
    function order_info(goods_id) {
        layer.open({ type: 2, shadeClose: false });
        ajaxEve('post', server.get_order_info, { goods_id: goods_id }, function (data) {    //身份认证
            layer.closeAll();
            if (data.status == 200) {
                $(".name_1").html('“' + data.list.name + '”');
                $(".p_2").html(data.list.info);
                operator = data.list.operator;
                price = data.list.price;

                if (data.list.is_owner == '1') {
                    
                    $("#demo3").val(data.list.place);
                    $("#demo3_id").val(data.list.owner_place);
                    $("#demo2").val('随机号码');

                    $("#demo2_id").val(data.list.phone);

                } else {
                    Place_of_ownership(operator);  //获取归属地
                    //清空手机号
                    $("#demo3").click(function () {
                        $("#demo2").val('');
                        $("#demo2_id").val(data.list.phone);
                    })
                    //选择号码事件
                    $(".phone_number").click(function () {
                        _this.demo3 = $("#demo3").val();
                        _this.demo3_id = $("#demo3_id").val();
                        if (_this.demo3 == '') {
                            layerOpen1('请先选择号码归属地');
                            return false;
                        }
                        phone_num(_this.demo3);
                    })
                }



                var oper_type = data.list.operator
                var formData_1 = {
                    img_type: 'Z',
                    oper_type: oper_type,
                }
                var formData_2 = {
                    img_type: 'F',
                    oper_type: oper_type,
                }
                var formData_3 = {
                    img_type: 'P',
                    oper_type: oper_type,
                }

                Pictureupload_2(uploader1, '.filePicker_1', imgurl1, formData_1);
                Pictureupload_2(uploader2, '.filePicker_2', imgurl2, formData_2);
                Pictureupload_2(uploader3, '.filePicker_3', imgurl3, formData_3);


            }
        }, function (data) {
            layerOpen1(data.msg);
            return;
        });
    }

    //是否同意协议
    $(".Agreement img").click(function () {
        // console.log($(this).attr('data-chec'));
        if ($(this).attr('data-chec') == 'false') {
            $(this).attr('data-chec', 'true');

            $(this).attr('src', './images/select.png');
        } else {
            $(this).attr('data-chec', 'false');
            $(this).attr('src', './images/noselect.png');
        }
    })
    //协议
    $(".Agreement_btn").click(function () {
        $(".Popup_2").show();
        agreement();
    })

    
    function agreement() {
      layer.open({ type: 2, shadeClose: false });
      ajaxEve('post', server.get_agreement, { }, function (data) {    //身份认证
          layer.closeAll();
          if (data.status == 200) {
            $(".popup_cen_2").html(data.list.info)
          }
      }, function (data) {
          layerOpen1(data.msg);
          return;
      });
  }

    $(".close_1").click(function () {
        $(".Popup_2").hide();
    })


    //关闭弹窗
    $(".close").click(function () {
        $(".Popup_1").hide();
    })

    //换一批接口
    $(".change_btn").click(function () {
        phone_num();
    })

    //选择手机号
    $(".cen_1").delegate("li", "click", function () {
        _this.phone_tex = $(this).text();
        $("#demo2").val(_this.phone_tex);
        $("#demo2_id").val(_this.phone_tex);

        $(".Popup_1").hide();
    })

    //选择号码接口
    function phone_num() {
        layer.open({ type: 2, shadeClose: false });
        _this.phoneData = {
            'type': operator,
            'part': _this.demo3_id
        }
        ajaxEve('post', server.phone, _this.phoneData, function (data) {    //身份认证
            var cen_1_list = $(".cen_1");
            var cen_1bodyList = $("#cen_1");
            layer.closeAll();
            if (data.status == 200) {
                $(".Popup_1").show();
                jo.reTpl(cen_1bodyList, { data: data.list }, cen_1_list);
            }
        }, function (data) {
            layerOpen1(data.msg);
            return;
        });
    }


    //号码归属地
    function Place_of_ownership(operator) {


        layer.open({ type: 2, shadeClose: false });
        ajaxEve('post', server.phone_ownership, { type: operator }, function (data) {    //身份认证
            layer.closeAll();
            let cityData = [];
            if (data.status == 200) {
                for (var i in data.list) {
                    cityData.push({
                        id: i,
                        name: data.list[i]
                    })
                }

                var area1 = new LArea();
                area1.init({
                    'trigger': '#demo3', //触发选择控件的文本框，同时选择完毕后name属性输出到该位置
                    'valueTo': '#demo3_id', //选择完毕后id属性输出到该位置
                    'keys': {
                        id: 'id',
                        name: 'name'
                    }, //绑定数据源相关字段 id对应valueTo的value属性输出 name对应trigger的value属性输出
                    'type': 1, //数据源类型
                    'data': cityData //数据源
                });
                area1.value = [1, 13, 3];//控制初始位置，注意：该方法并不会影响到input的value
                console.log(cityData);

            }
        }, function (data) {
            layerOpen1(data.msg);
            return;
        });
    }






    //提交订单
    $(".btn").click(function () {
        var _this = this;
        _this.username = $(".username").val();      //姓名
        _this.user_idnum = $(".user_idnum").val();  //身份证号
        _this.phone_num = $(".phone_num").val();    //手机号码
        _this.one_img = $(".judge-or1").attr('data-up');
        _this.two_img = $(".judge-or2").attr('data-up');
        _this.three_img = $(".ren").attr('data-up');

        _this.demo1 = $("#demo1").val();                 //所在区域
        _this.details_city = $(".details_city").val();   //详细地址



        if (!isRename(_this.username)) {
            layer.open({
                content: '请输入身份证件姓名', skin: 'msg', time: 2
            });
            return false
        }
        if (!isCardNo(_this.user_idnum)) {
            layer.open({
                content: '请输入正确的身份证号', skin: 'msg', time: 2
            });
            return false
        }
        if (!checkMobile(_this.phone_num)) {
            layer.open({
                content: '请输入正确的手机号码', skin: 'msg', time: 2
            });
            return false
        }

        if ($("#demo2").val() == '') {
            layer.open({
                content: '请选择电话号码', skin: 'msg', time: 2
            });
            return false
        }

        if (_this.one_img == 'false' || _this.one_img == undefined) {
            layerOpen1('请上传身份证人面像');
            return false;
        }
        if (_this.two_img == 'false' || _this.two_img == undefined) {
            layerOpen1('请上传身份证国徽面');
            return false;
        }
        if (_this.three_img == 'false' || _this.three_img == undefined) {
            layerOpen1('请上传免冠照片');
            return false;
        }



        if ($("#demo1").val() == '') {
            layer.open({
                content: '请选择所在区域', skin: 'msg', time: 2
            });
            return false
        }
        if (_this.details_city == '') {
            layer.open({
                content: '请输入详细地址', skin: 'msg', time: 2
            });
            return false
        }

        if ($(".Agreement img").attr('data-chec') == 'false') {
            layer.open({
                content: '请同意客户入网服务协议及业务协议', skin: 'msg', time: 2
            });
            return false;
        }



        layer.open({ type: 2, shadeClose: false });
        _this.orderData = {
            'goods_id': goods_id,
            'name': _this.username,
            'card': _this.user_idnum,
            'phone': $("#demo2_id").val(),
            'region': $("#demo3_id").val(),
            'tel': _this.phone_num,
            'city': _this.demo1,
            'address': _this.details_city,
            'payment': price,
            'type': operator,
        }
        ajaxEve('post', server.create_order, _this.orderData, function (data) {    //创建订单
            layer.closeAll();
            if (data.status == 200) {
                if (data.list.wx_res == '') {
                    layer.open({
                        content: data.msg, skin: 'msg', time: 2
                    });
                    history.go(-1);
                } else {
                    var appId = data.list.wx_res.appId;
                    var nonceStr = data.list.wx_res.nonceStr;
                    var package = data.list.wx_res.package;
                    var paySign = data.list.wx_res.paySign;
                    var signType = data.list.wx_res.signType;
                    var timeStamp = data.list.wx_res.timeStamp;
                    onBridgeReady(appId, nonceStr, package, paySign, signType, timeStamp);
                }

            }
        }, function (data) {
            layerOpen1(data.msg);
            return;
        });

    })



}

//姓名正则
function isRename(realname) {
    //姓名格式为2-4为纯中文
    var name = $.trim(realname);
    var reg = /^([\u4e00-\u9fa5]){2,10}$/;
    return reg.test(name);
};
//手机号正则
function checkMobile(sMobile) {
    var phone = $.trim(sMobile);
    var reg = /^1\d{10}$/;
    return reg.test(phone);
};
//身份证号正则
function isCardNo(card) {
    // 身份证号码为15位或者18位，15位时全为数字，18位前17位为数字，最后一位是校验位，可能为数字或字符X
    var idNumber = $.trim(card);
    var reg = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;
    return reg.test(idNumber);
};

// 微信支付
function onBridgeReady(appId, nonceStr, package, paySign, signType, timeStamp) {
    WeixinJSBridge.invoke(
        'getBrandWCPayRequest', {
        "appId": appId,     //公众号名称，由商户传入     
        "timeStamp": timeStamp,         //时间戳，自1970年以来的秒数     
        "nonceStr": nonceStr, //随机串     
        "package": package,
        "signType": signType,         //微信签名方式：     
        "paySign": paySign //微信签名 
    },
        function (res) {
            if (res.err_msg == "get_brand_wcpay_request:ok") {
                // 使用以上方式判断前端返回,微信团队郑重提示：
                //res.err_msg将在用户支付成功后返回ok，但并不保证它绝对可靠。
                history.go(-1);
            }
        });
}
// if (typeof WeixinJSBridge == "undefined"){
//     if( document.addEventListener ){
//         document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false);
//     }else if (document.attachEvent){
//         document.attachEvent('WeixinJSBridgeReady', onBridgeReady); 
//         document.attachEvent('onWeixinJSBridgeReady', onBridgeReady);
//     }
//  }else{
//     onBridgeReady();
//  }






function Pictureupload_2(name, classtype, datashuju, formData) {
    // var _this = this;


    name = WebUploader.create({// 选完文件后，是否自动上传。
        auto: true,// swf文件路径
        swf: 'Uploader.swf',// 文件接收服务端。
        server: server.card_discern,// 选择文件的按钮。可选。
        // server: '/prxy/api/card_discern',// 选择文件的按钮。可选。
        pick: classtype,
        resize: false,// 只允许选择图片文件。
        formData: formData,

        accept: {
            title: 'Images',
            extensions: 'gif,jpg,jpeg,bmp,png',
            mimeTypes: 'image/*'
        }
    });
    // 当有文件添加进来的时候
    name.on('fileQueued', function (file) {

        layer.open({ type: 2, shadeClose: false });

    });
    // 携带请求头
    name.on('uploadBeforeSend', function (object, data, headers) {
        headers.token = sessionStorage.getItem("token");
        headers.account = sessionStorage.getItem("account");
    })
    // 文件上传成功，给item添加成功class, 用样式标记上传成功。
    name.on('uploadBeforeSend', function (object, data) {
        data.user_name = $(".username").val();
        data.card = $(".user_idnum").val();
        data.phone = $("#demo2_id").val();
    })
    name.on('beforeFileQueued', function (file) {
        var obj = {
            username: $(".username").val(),
            user_idnum: $(".user_idnum").val(),
            phone_num: $(".phone_num").val(),
        }

        if (!isRename(obj.username)) {
            layer.open({
                content: '请输入身份证件姓名', skin: 'msg', time: 2
            });
            return false
        }
        if (!isCardNo(obj.user_idnum)) {
            layer.open({
                content: '请输入正确的身份证号', skin: 'msg', time: 2
            });
            return false
        }
        if (!checkMobile(obj.phone_num)) {
            layer.open({
                content: '请输入正确的手机号码', skin: 'msg', time: 2
            });
            return false
        }

        if ($("#demo2").val() == '') {
            layer.open({
                content: '请选择电话号码', skin: 'msg', time: 2
            });
            return false
        }


    })
    name.on('uploadSuccess', function (file, data) {
        layer.closeAll();
        if (data.status == 200) {
            layer.open({
                content: '上传成功', skin: 'msg', time: 2
            });
            datashuju = data.list.img;
            $(classtype).prev('img').attr('src', datashuju);
            $(classtype).prev('img').attr('data-up', true);
            if ($(classtype).prev('img').length == 1) {
                $('.up_bg').hide();
                $('.up_wenzi').hide();
                $('.up_img').css({ 'display': 'flex', 'justify-content': 'center' })
                $('.judge-or').show();
                $('.judge-wei').show();
            };
        } else{
            $(classtype).prev('img').attr('data-up', false); 
            layer.open({
                content: data.msg, skin: 'msg', time: 2
            });
        }

    });
    // 文件上传失败，显示上传出错。
    name.on('uploadError', function (file) {
        $(classtype).prev('img').attr('data-up', false);
        layer.closeAll();
        layer.open({
            content: '图片上传失败', skin: 'msg', time: 2
        });
    });
};
networking.prototype.hk_mine = function (argument) {
  //前往收益明细
  $('.my_profit .profitDetailed').click(function () {
    self.location.href = "profitDetailed.html";
  })
  //前往推广记录
  $('.my_profit .recordExtension').click(function () {
    self.location.href = "recordExtension.html";
  })
  //前往提现页面
  $('.Cash_withdrawal .cashWithdrawal').click(function () {

      if($(this).attr('data-auth') == '1'){
        self.location.href = "cashWithdrawal.html?auth=" + '1';
        return false;
      }else if($(this).attr('data-auth') == '4'){
        self.location.href = "cashWithdrawal.html?auth=" + '4';
        return false;
      }else if($(this).attr('data-auth') == '2'){
        layerOpen1('实名认证中，请耐心等待');
        return false;
      }else{
        layer.open({
            content: '失败原因：'+$(this).attr('data-note'),skin: 'msg',time: 2
        });
        window.setTimeout(function(){
          self.location.href = "realAuthentication.html";
        },2000);
        return false;
      }

  })
  //前往提现记录
  $('.Cash_withdrawal .recordCash').click(function () {
    self.location.href = "recordCash.html";
  })

  //前往实名认证页面
  $('.authentication_info').click(function () {
    if($(this).attr('data-auth') == '1'){
      self.location.href = "realAuthentication.html";
      return false;
    }else if($(this).attr('data-auth') == '4'){
      layerOpen1('认证成功，无需重复认证');
      return false;
    }else if($(this).attr('data-auth') == '2'){
      layerOpen1('实名认证中，请耐心等待');
      return false;
    }else{
      layer.open({
          content: '失败原因：'+$(this).attr('data-note'),skin: 'msg',time: 2
      });
      window.setTimeout(function(){
        self.location.href = "realAuthentication.html";
      },2000);
      return false;
    }
  })

  mine_users_info();
  //个人信息接口
  function mine_users_info(){
    ajaxEve('post', server.users_info,{}, function (data) {    //商品列表
        layer.closeAll();
        if(data.status == 200){
            $(".id_card").html(data.list.ID);
            $('.nickname').html(data.list.nickname);
            $(".cashWithdrawal").attr('data-auth',data.list.is_auth);
            $(".cashWithdrawal").attr('data-note',data.list.note);

            $(".mine_top img").attr('src',data.list.avatar)

            $(".span_1").html('￥'+data.list.commission);
            $(".p_2 span").html('+'+data.list.new_commission);

            $(".authentication_info").attr('data-auth',data.list.is_auth);
            $(".authentication_info").attr('data-note',data.list.note);
            
            if(data.list.is_auth == '1'){
              $(".authentication_info p").html('为了资金安全，请您尽快完成实名认证，以享受更多权益 >');
            }
            if(data.list.is_auth == '2'){
              $(".authentication_info p").html('身份信息认证中,请耐心等待 >');
            }
            if(data.list.is_auth == '3'){
              $(".authentication_info p").html('实名认证失败 >');
            }
            if(data.list.is_auth == '4'){
              $(".authentication_info p").html('身份信息认证成功 >');
            }




        }
    }, function (data) {
        layerOpen1(data.msg);
        return;
    });
}

}
networking.prototype.hk_orderQuery = function (argument) {
  var _this = this;
  $(".btn").click(function(){
    _this.phone_num = $(".phone_num").val();
    _this.six_num = $(".six_num").val();
    if (!_this.checkMobile(_this.phone_num)) {
			layerOpen1('请输入正确的手机号');
			return false;
    };
    if (_this.six_num == '' || _this.six_num.length != 6) {
			layerOpen1('请输入身份证后6位');
			return false;
    };
    self.location.href = "recordOrder.html?tel=" + _this.phone_num + '&card=' + _this.six_num;

  })
}
networking.prototype.hk_profitDetailed = function (argument) {
  var _this = this;
  profit_Detail();
  function profit_Detail(){
    _this.profit_Data = {
      'account':sessionStorage.getItem("account"),
      'page':1,
      'size':100
  };
  layer.open({type: 2 ,shadeClose:false});
    ajaxEve('post', server.earn_list,_this.profit_Data, function (data) {    //商品列表
        var recordCash_list = $(".recordCash_list");
        var recordCashbodyList = $("#recordCash_list");
        layer.closeAll();
        if(data.status == 200){
          jo.reTpl(recordCashbodyList,{data:data.list.earn_list},recordCash_list);
        }
    }, function (data) {
        layerOpen1(data.msg);
        return;
    });
}
}
networking.prototype.hk_pushcard = function (argument) {
  var _this = this;
  // 关闭弹框
  $(".close").click(function () {
    $(".Popup").hide();
  })

  goods_return_Data();
  //显示弹框
  $(".pushcard_list").delegate("li", "click", function () {
    $(".Popup").show();
    $(".cen_1").show();
    $(".cen_2").hide();
    _this.goods_id = $(this).attr('data-id');
    console.log(_this.goods_id)
    extension_link1();
  });

  $(".top_2").click(function(){
    $(".Popup").show();
    $(".cen_2").show();
    $(".cen_1").hide();
    _this.goods_id = $(this).attr('data-id');
    // console.log(_this.goods_id)
    get_all();
  });

  //获取推广汇总产品
  function get_all(){
    layer.open({ type: 2, shadeClose: false });
    ajaxEve('post', server.get_all_link, {}, function (data) {    //商品列表
      layer.closeAll();
      if (data.status == 200) {
        var link = data.list.link;
        $(".copy_inp .copy_cen").val(data.list.link);   //分享链接
        $(".cen2_name").text(data.list.title);//标题
        $(".cen2_p3").text(data.list.detail);  //内容
        $(".btn").attr('data-src',data.list.qrcode);
        copyDta(link);
      }
    }, function (data) {
      layerOpen1(data.msg);
      return;
    });
  }


  // 获取商品推广信息
  function extension_link1() {
    _this.qrcode_Data = {
      'goods_id': _this.goods_id,
    };
    layer.open({ type: 2, shadeClose: false });
    ajaxEve('post', server.extension_link, _this.qrcode_Data, function (data) {    //商品列表
      layer.closeAll();
      if (data.status == 200) {
        // console.log(data);
        var link = data.list.link;
        $(".copy_inp .copy_cen").val(data.list.link);   //分享链接
        $(".cen_name").text(data.list.info.name);   //名称
        $(".cen_p3").text(data.list.info.skus);      //商品说明
        $(".earnings_condition").text(data.list.info.earnings_condition);
        if (data.list.info.operator == '1') {
          $(".cen1_1").text('移动');
        }
        if (data.list.info.operator == '2') {
          $(".cen1_1").text('联通');
        }
        if (data.list.info.operator == '3') {
          $(".cen1_1").text('电信');
        }

        if (data.list.info.is_owner == '1') {
          $(".cen1_2").text('可选');
        }
        if (data.list.info.is_owner == '0') {
          $(".cen1_2").text('不可选');
        }

        $(".look_details").attr('data-id',data.list.info.id);
        $(".btn").attr('data-src',data.list.qrcode);


        copyDta(link);
      }
    }, function (data) {
      layerOpen1(data.msg);
      return;
    });
  }

  //前往二维码页面
  $(".btn").click(function(){
    _this.qrcode = $(this).attr('data-src');
    self.location.href = "qrCode.html?qrcode=" + _this.qrcode;
  })


  //复制
  function copyDta(link) {
    $(".copy").click(function () {
      $(".copy_cen").val(link);
      $(".copy_cen").select();
      document.execCommand("Copy")
      layer.open({
        content: '复制成功', skin: 'msg', time: 2
      });
    })
  }

  //红色查看商品详情
  $(".look_details").click(function(){
    _this.goods_id = $(this).attr('data-id');
    self.location.href="goodsDetails.html?goods_id=" + _this.goods_id;
  })





  //返佣卡接口
  function goods_return_Data() {
    _this.goods_Data = {
      'page': 1,
      'size': 100
    };
    layer.open({ type: 2, shadeClose: false });
    ajaxEve('post', server.goods_return, _this.goods_Data, function (data) {    //商品列表
      var pushcard_list = $(".pushcard_list");
      var pushcardbodyList = $("#pushcard_list");

      layer.closeAll();
      if (data.status == 200) {
        console.log(data);
        jo.reTpl(pushcardbodyList, { data: data.list.goods_list }, pushcard_list);
      }
    }, function (data) {
      layerOpen1(data.msg);
      return;
    });
  }
}
networking.prototype.hk_qrcode = function (argument) {
    var qrcode = GetQueryString('qrcode');
    $(".qrcode_mian img").attr('src', qrcode);
}
networking.prototype.hk_realAuthentication = function (argument) {
  var _this = this;
  var imgurl1, imgurl2, imgurl3, uploader1, uploader2, uploader3;
  Pictureupload_1(uploader1, '.filePicker_1', imgurl1);
  Pictureupload_1(uploader2, '.filePicker_2', imgurl2);
  Pictureupload_1(uploader3, '.filePicker_3', imgurl3);

  $(".btn span").click(function () {

    _this.username = $('.username').val();
    _this.Idnumber = $('.Idnumber').val();

    _this.one_img = $(".judge-or1").attr('data-up');
    _this.two_img = $(".judge-or2").attr('data-up');
    _this.three_img = $(".ren").attr('data-up');

    _this.one_img_1 = $(".judge-or1").attr('src');
    _this.two_img_1 = $(".judge-or2").attr('src');
    _this.three_img_1 = $(".ren").attr('src');
    

    if (!_this.isRename(_this.username)) {
      layerOpen1('请输入真实姓名');
      return false;
    };
    if (!_this.isCardNo(_this.Idnumber)) {
      layerOpen1('请输入正确的身份证号');
      return false;
    };

    if(_this.one_img == 'false' || _this.one_img == undefined){
      layerOpen1('请上传身份证人面像');
      return false;
    }
    if(_this.two_img == 'false' || _this.two_img == undefined){
      layerOpen1('请上传身份证国徽面');
      return false;
    }
    if(_this.three_img == 'false' || _this.three_img == undefined){
      layerOpen1('请上传免冠照片');
      return false;
    }



    _this.auth_save_Data = {
      'realname': _this.username,
      'card':_this.Idnumber,
      'card_img': _this.one_img_1,
      'card_imgs':_this.two_img_1,
      'image':_this.three_img_1
    };
    layer.open({ type: 2, shadeClose: false });
    ajaxEve('post', server.users_auth_save, _this.auth_save_Data, function (data) {    //身份认证
      layer.closeAll();
      if (data.status == 200) {
        layer.open({
          content: data.msg,skin: 'msg',time: 2
        });
        window.setTimeout(function(){
          self.location.href = "mine.html";
        },2000);
      }
    }, function (data) {
      layerOpen1(data.msg);
      return;
    });



  })
}

function Pictureupload_1(name, classtype, datashuju) {
  name = WebUploader.create({// 选完文件后，是否自动上传。
    auto: true,// swf文件路径
    swf: 'Uploader.swf',// 文件接收服务端。
    server: server.uploadImg,// 选择文件的按钮。可选。
    // server: '/prxy/api/oss/upload',// 选择文件的按钮。可选。
    pick: classtype,
    resize: false,// 只允许选择图片文件。
    accept: {
      title: 'Images',
      extensions: 'gif,jpg,jpeg,bmp,png',
      mimeTypes: 'image/*'
    }
  });
  // 当有文件添加进来的时候
  name.on('fileQueued', function (file) {
    layer.open({ type: 2, shadeClose: false });
  });
  // 携带请求头
  name.on('uploadBeforeSend',function(object ,data ,headers){
      headers.token = sessionStorage.getItem("token");
      headers.account = sessionStorage.getItem("account");
  })
  // 文件上传成功，给item添加成功class, 用样式标记上传成功。
  name.on('uploadSuccess', function (file, data) {
    layer.closeAll();
    if (data.status == 200) {
      layer.open({
        content: '上传成功', skin: 'msg', time: 2
      });
    } else layer.open({
      content: data.msg, skin: 'msg', time: 2
    });
    datashuju = data.list;
    $(classtype).prev('img').attr('src', datashuju);
    $(classtype).prev('img').attr('data-up', true);
    if ($(classtype).prev('img').length == 1) {
      $('.up_bg').hide();
      $('.up_wenzi').hide();
      $('.up_img').css({ 'display': 'flex', 'justify-content': 'center' })
      $('.judge-or').show();
      $('.judge-wei').show();
    };
  });
  // 文件上传失败，显示上传出错。
  name.on('uploadError', function (file) {
    layer.closeAll();
    layer.open({
      content: '图片上传失败', skin: 'msg', time: 2
    });
  });
};
networking.prototype.hk_recordCash = function (argument) {
  recordCash_jie();
  function recordCash_jie(){
    ajaxEve('post', server.users_cash,{}, function (data) {    //商品列表
      var recordCash_list = $(".recordCash_list");
      var recordCashbodyList = $("#recordCash_list");
        layer.closeAll();
        if(data.status == 200){
            // console.log(data);
            jo.reTpl(recordCashbodyList,{data:data.list.lists},recordCash_list);
        }
    }, function (data) {
        layerOpen1(data.msg);
        return;
    });
}
}
networking.prototype.hk_recordExtension = function (argument) {
  var _this = this;
  profit_Detail();
  function profit_Detail(){
    

    _this.profit_Data = {
      'account':sessionStorage.getItem("account"),
      'page':1,
      'size':100
  };
  layer.open({type: 2 ,shadeClose:false});
    ajaxEve('post', server.recommend_list,_this.profit_Data, function (data) {    //商品列表
        var recordCash_list = $(".recordCash_list");
        var recordCashbodyList = $("#recordCash_list");
        layer.closeAll();
        if(data.status == 200){
          jo.reTpl(recordCashbodyList,{data:data.list.order_list},recordCash_list);
        }
    }, function (data) {
        layerOpen1(data.msg);
        return;
    });
}
}
networking.prototype.hk_recordOrder = function (argument) {
    var _this = this;
    _this.tel = GetQueryString('tel');
    _this.card = GetQueryString('card');
    _this.query_Data = {
      'tel':_this.tel,
      'card':_this.card
  };
  layer.open({type: 2 ,shadeClose:false});
  ajaxEve('post', server.query,_this.query_Data, function (data) {    //商品列表
      var recordCash_list = $(".recordCash_list");
      var recordCashbodyList = $("#recordCash_list");
      layer.closeAll();
      if(data.status == 200){
          jo.reTpl(recordCashbodyList,{data:data.list.list},recordCash_list);
      }
  }, function (data) {
      layerOpen1(data.msg);
      return;
  });


}
networking.prototype.home = function (argument) {
	var _this = this;
	if(!accontdata || !tokendata){
		$('.yield_box').hide();
		$('.Mineral_mian').hide();
		$('.ding').hide();	
		$('.zhong').hide();
		$('.zai').show();
	}else {
		$('.Mineral_mian').hide();
		$('.zai').hide();
		$('.ding').hide();	
		$('.zhong').hide();
		Dataacquisition();
	};
	$.post(server.notice,{},function(result){
		if (result.status == 200) {
			$('.swipe_list li').html(result.data)
		};
	});
	function Dataacquisition(){//有没有矿机
		ajaxEve('post', server.myproductlist, {}, function (result) {
		    if (result.status == 200) {
		        if(result.data.length == '0'){
		        	$('.zai').show();
		        }else {
		        	Logonstatus();
		        	paopaobacklist();
		        };
		    };
		}, function (result) {
		    return;
		});
	};

	function Logonstatus(){//有没有列表
		ajaxEve('post', server.user_info, {}, function (result) {
		    if (result.status == 200) {
		    	$('.zai').hide();
		    	switch (result.data.miner_info.status) {
		    		case '1':
		    				$('.zhong').show();
		    			break;
		    		case '2':
		    			$(".Cumulativeincome .Profit_num").html(result.data.miner_info.allprice+"CLW");
				        $(".Currentincome .Profit_num").html(result.data.dangqian_shouyi+"CLW");
		    			if(result.data.miner_info.state == "1"){
		    				$('.Mineral_mian').show();
		    			}else {
		    				$('.ding').show();
		    			}
		    			break;
		    		case '3':
		    				$('.ju').show();
		    			break;
		    		default:
		    			// statements_def
		    			break;
		    	}
		        
		        return;
		    };
		}, function (result) {
		    return;
		});
		ajaxEve('post', server.mypaopaolist, {}, function (result) {
		    if (result.status == 200) {
		        jo.reTpl($('#test1'),result,$('.yield_box'));
		        seruer();
		        return;
		    };
		}, function (result) {
		    return;
		});
		
	};
	function paopaobacklist(){
		ajaxEve('post', server.paopaobacklist, {}, function (result) {
		    if (result.status == 200) {
		        jo.reTpl($('#test2'),result,$('.Mineral_record'));
		        seruer();
		        return;
		    };
		}, function (result) {
		    return;
		});
	};
	function seruer(){
		$('.yield_list').click(function(){
			var dataid = $(this);
			ajaxEve('post', server.paopaolingqupost, {id:dataid.attr('data_id')}, function (result) {
				if(result.status == 200){
					dataid.hide();
					Logonstatus();
					paopaobacklist()
				};
			    layer.open({
			            content: result.msg,skin: 'msg',time: 2 
			        });
			}, function (result) {
			    return;
			});
		});
	};
};


// 获取用户信息,判断实名与设置资金密码
networking.prototype.userInfoMarket = function () {
    var _this = this;
    ajaxEve('POST', server.user_info, {}, function (result) {
            if (result.status == 200) {
                _this.setPassOr = result.data.has_tpwd;
                _this.setIdentifyOr = result.data.status;
                _this.setPayWayAil = result.data.ali_info.alicard;
                _this.setPayWayBank = result.data.bank_info.realname;
                _this.setPayWayWx = result.data.wx_info.wxcard;
                _this.realname = result.data.realname;
                _this.mobile1 = result.data.mobile;
                $('.cankanjia').html(result.data.ks_price);
            }
        },
        function (result) {
            layer.open({
                content: result.msg,skin: 'msg',time: 2
            });
            return;
        });
};



//挂买单
networking.prototype.guaBuy = function(){
    var _this = this;
    _this.mainHeaderArr = $('.main_header li');//矿市tab
    _this.mainContentArr = $('.main_content .main_content1');//矿市tab对应内容
    _this.billBils = $('.bill_bils li');//挂单tab
    _this.billList = $('.bills_list');//挂单tab对应content
    _this.priceReduce = $('.price_reduce');//出价增加
    _this.priceAdd = $('.price_add');//出价减少
    _this.billPrice = $('#bill_price');//价格值
    _this.billNum = $('#bill_num');//数量值
    _this.countNum = $('.count_num');//挂单数量
    _this.countPrice = $('.count_price');//挂单价格
    _this.countTotal = $('.count_total');//总挂单数
    _this.mainHeaderArr.on('click', function() {
        _this.mainHeaderArr.removeClass('header_active');
        $(this).addClass('header_active');
        _this.mainContentArr.hide();
        let clikIndex = $(this).index();
        _this.mainContentArr.eq(clikIndex).show();
    });
    //挂单tab
    _this.billBils.on('click', function(){
        _this.billBils.removeClass('bills_active');
        $(this).addClass('bills_active');
        _this.billList.hide();
        let clikIndex = $(this).index();
        _this.billList.eq(clikIndex).show();
    });
    // 出价增加
    _this.priceAdd.on('click', function(){
        let priceValue = _this.billPrice.val();
        priceValue = _this.Addition(priceValue,1);
        _this.billPrice.val(priceValue);
        _this.countPrice.html(priceValue);
        let countTotal = _this.Multiplication(priceValue,_this.billNum.val());
        _this.countTotal.html(countTotal);
    });
    //出价减少
    _this.priceReduce.on('click', function(){
        let priceValue = _this.billPrice.val();
        if(priceValue > 1){
            priceValue = _this.Subtraction(priceValue,1);
            _this.Subtraction(priceValue,1);
        }
        _this.billPrice.val(priceValue);
        _this.countPrice.html(priceValue);
        let countTotal = _this.Multiplication(priceValue,_this.billNum.val());
        _this.countTotal.html(countTotal)
    });
    //出价改变
    _this.billPrice.on('input', function(){
        let priceValue = $(this).val();
        _this.countPrice.html(priceValue);
        let countTotal = _this.Multiplication(priceValue,_this.billNum.val());
        _this.countTotal.html(countTotal)
    });
    //数量改变
    _this.billNum.on('input', function(){
        let priceValue = $(this).val();
        _this.countNum.html(priceValue);
        let countTotal = _this.Multiplication(priceValue,_this.billPrice.val());
        _this.countTotal.html(countTotal)
    });

    $('.quxiao').on('click', function(){
       $(".tan").hide();
    });


    //挂买单
    $('.guamaidan').on('click', function(){
        var billPrice = $('#bill_price').val();
        var billNum = $('#bill_num').val();
        var billPass = $('#bill_pwsd').val();
        if (!billPrice) {
            layer.open({
                content: '请输入挂单价格',skin: 'msg',time: 2
            });
            return false;
        }
        if (!billNum) {
            layer.open({
                content: '请输入挂单数量',skin: 'msg',time: 2
            });
            return false;
        }
        if (!billPass) {
            layer.open({
                content: '请输入交易密码',skin: 'msg',time: 2
            });
            return false;
        }
        if(_this.setPassOr == 0){
            // $('.tan-password').show();
            layer.open({
                className: 'popuo-login',
                content:'<p>您还未设置交易密码，是否前往设置</p>',
                shadeClose:false,   //点击遮罩层是否关闭弹窗
                btn: ['前往', '取消'],
                yes: function(){
                    window.location.href = './editpasswordpay.html';
                }
            });
            return false;
        }
        if(_this.setIdentifyOr == 1 || _this.setIdentifyOr == 4){
            // $('.tan-shiming').show();
            layer.open({
                className: 'popuo-login',
                content:'<p class="tips-content">您还未实名认证，是否前往实名认证</p>',
                shadeClose:false,   //点击遮罩层是否关闭弹窗
                btn: ['前往', '取消'],
                yes: function(){
                    window.location.href = './identify.html';
                }
            });
            return false;
        }
        if(_this.setIdentifyOr == 2){
            // $('.tan-shiming-shehe').show();
            layer.open({
                className: 'popuo-login',
                content:'<p class="tips-content">您的实名认证正在审核中</p>',
                shadeClose:false,   //点击遮罩层是否关闭弹窗
                btn: ['前往查看', '取消'],
                yes: function(){
                    window.location.href = './persondata.html';
                }
            });
            return false;
        }
        if(!_this.setPayWayAil && !_this.setPayWayBank && !_this.setPayWayWx){
            // $(".tan-payway").show();
            layer.open({
                className: 'popuo-login',
                content:'<p class="tips-content">您还未设置支付方式，是否前往设置</p>',
                shadeClose:false,   //点击遮罩层是否关闭弹窗
                btn: ['前往', '取消'],
                yes: function(){
                    window.location.href = './modepayment.html';
                }
            });
            return false;
        }
        _this.Submitdata = {
            "buynum":billNum,
            'price':billPrice,
            'tpwd':billPass
        };
        var layerOpen =  layer.open({type: 2 ,shadeClose:false});
        ajaxEve('post', server.market_guamaidan, _this.Submitdata, function (result) {
            layer.close(layerOpen);
            console.log(result)
            if (result.status == 200) {
                layer.open({
                    content:result.msg,skin: 'msg',time: 2
                });
                setTimeout(function(){
                    location.reload();
                },1500);
                return;
            }
        }, function (result) {
            layer.open({
                content: result.msg,skin: 'msg',time: 2
            });
            setTimeout(function(){
                layer.close(layerOpen);
            },1500);
            return;
        });
    });

    //玩家挂单
    ajaxEve('post', server.market_playerPull, {account:sessionStorage.account}, function (result) {
        if (result.status == 200) {
            // jo.reTpl(dovbooy,result,dov);
            var dataStr = '';
            for(var i = 0; i < result.data.length; i++){
                if(result.data[i].account == sessionStorage.account){
                    dataStr += '<div class="list_item"><ul><li><i></i>单号：'+result.data[i].order_no+'</li><li>'+result.data[i].addtime+'</li></ul><div class="item_count">'+result.data[i].str+'</div></div>';
                }else{
                    dataStr += '<div class="list_item"><ul><li><i></i>单号：'+result.data[i].order_no+'</li><li>'+result.data[i].addtime+'</li></ul><div class="item_count">'+result.data[i].str+'</div><div class="item_buy">出售</div><div class="tan tan-chushou"><div class="tan-content"><div class="title">出售 <div class="icon"></div></div><div class="chushou-content"><div class="password">交易密码</div><div class="password1">请严格按照平台公布卖家资料进行打款，请勿相信中介！</div><div class="password2 numinput"><input type="password" placeholder="请输入交易密码"></div><ul class="btn"><li class="player-sell" data-id="'+result.data[i].order_no+'">确定出售</li><li class="quxiao">取消</li></ul></div></div></div></div>';
                }
            }
            $('.bills_list_other').html(dataStr);
            $('.item_buy').on('click', function(){
                if(_this.setPassOr == 0){
            // $('.tan-password').show();
                    layer.open({
                        className: 'popuo-login',
                        content:'<p>您还未设置交易密码，是否前往设置</p>',
                        shadeClose:false,   //点击遮罩层是否关闭弹窗
                        btn: ['前往', '取消'],
                        yes: function(){
                            window.location.href = './editpasswordpay.html';
                        }
                    });
                    return false;
                };
                if(_this.setIdentifyOr == 1 || _this.setIdentifyOr == 4){
                    // $('.tan-shiming').show();
                    layer.open({
                        className: 'popuo-login',
                        content:'<p class="tips-content">您还未实名认证，是否前往实名认证</p>',
                        shadeClose:false,   //点击遮罩层是否关闭弹窗
                        btn: ['前往', '取消'],
                        yes: function(){
                            window.location.href = './identify.html';
                        }
                    });
                    return false;
                };
                if(_this.setIdentifyOr == 2){
                    layer.open({
                        className: 'popuo-login',
                        content:'<p class="tips-content">您的实名认证正在审核中</p>',
                        shadeClose:false,   //点击遮罩层是否关闭弹窗
                        btn: ['前往查看', '取消'],
                        yes: function(){
                            window.location.href = './persondata.html';
                        }
                    });
                    return false;
                };
                if(!_this.setPayWayAil && !_this.setPayWayBank && !_this.setPayWayWx){
                    layer.open({
                        className: 'popuo-login',
                        content:'<p class="tips-content">您还未设置支付方式，是否前往设置</p>',
                        shadeClose:false,   //点击遮罩层是否关闭弹窗
                        btn: ['前往', '取消'],
                        yes: function(){
                            window.location.href = './modepayment.html';
                        }
                    });
                    return false;
                };
                $(this).next('.tan-chushou').show();
            });
            //出售
            $('.quxiao').on('click', function(){
                $(".tan").hide();
            });
            $('.player-sell').on('click', function(){
                var orderNum = $(this).attr('data-id');
                var passwordDeal = $(this).parent('.btn').prev('.numinput').find('input').val();
                if (!passwordDeal) {
                    layer.open({
                        content: '请输入交易密码',skin: 'msg',time: 2
                    });
                    return false;
                }
                _this.Submitdata = {
                    "order_no":orderNum,
                    'tpwd':passwordDeal
                };
                var layerOpen =  layer.open({type: 2 ,shadeClose:false});
                ajaxEve('post', server.market_sell, _this.Submitdata, function (result) {
                    layer.close(layerOpen);
                    if (result.status == 200) {
                        layer.open({
                            content:result.msg,skin: 'msg',time: 2
                        });
                        $(".tan").hide();
                        location.reload();
                        return;
                    } else{
                        layer.open({
                            content:result.msg,skin: 'msg',time: 2
                        });
                    }
                }, function (result) {
                    layer.open({
                        content: result.msg,skin: 'msg',time: 2
                    });
                    setTimeout(function(){
                        layer.close(layerOpen);
                    },1500);
                    return;
                });
            });
            return;
        }
    }, function (result) {

    });

    //我的挂单
    $('.my-bill-pull').on('click', function(){
        var dovMine = $('.bills_list_mine');
        var dovbooyMine = $('#bills_list_mine');
        ajaxEve('post', server.market_myPull, {account:sessionStorage.account}, function (result) {
            if (result.status == 200) {
                if(result.data.length > 0){
                    jo.reTpl(dovbooyMine,result,dovMine);
                    // var orderNumber = result.data[0].order_no;
                    //申诉
                    var orderNumber;
                    $('.bills_list_mine .appeal').on('click', function(){
                        $(".tan-shensu").show();
                        orderNumber = $(this).attr('data-operate');
                    });
                    $(".shensu-btn").on('click', function(){
                        var reason = $(".reason").val();
                        var type = $('#shensu-type').val();
                        if (!reason) {
                            layer.open({
                                content: '请输入申诉理由',skin: 'msg',time: 2
                            });
                            return false;
                        }
                        var senData = {
                            'account':sessionStorage.account,
                            'order_no':orderNumber,
                            'ss_reason':reason,
                            'type':type
                        };
                        var layerOpen =  layer.open({type: 2 ,shadeClose:false});
                        ajaxEve('post', server.market_shensu, senData, function (result) {
                            layer.close(layerOpen);
                            if (result.status == 200) {
                                layer.open({
                                    content: result.msg,skin: 'msg',time: 2
                                });
                                setTimeout(function(){
                                    location.reload();
                                },2000);
                                return;
                            }else{
                                layer.open({
                                    content: result.msg,skin: 'msg',time: 2
                                });
                            }
                        }, function (result) {
                            setTimeout(function(){
                                layer.close(layerOpen);
                            },1500);
                        });
                    });
                    //卖家信息
                    $('.bills_list_mine .information').on('click', function(){
                        $(".tan-buyer-detail").show();
                        var dovDe = $('.tan-detail');
                        var dovbooyDe = $('#tan-detail');
                        var orderNumber = $(this).attr('data-operate');
                        var sendData = {
                            'account':sessionStorage.account,
                            'order_no':orderNumber
                        };
                        ajaxEve('post', server.market_sellerdetail, sendData, function (result) {
                            if (result.status == 200) {
                                jo.reTpl(dovbooyDe,result,dovDe);
                                _this.fuzhi = $('.fuzhi');
                                if(result.data.realname){
                                    var clipboard0 = new ClipboardJS( _this.fuzhi[0]);
                                    clipboard0.on('success', function(e) {
                                        layer.open({
                                            content: '复制成功',skin: 'msg',time: 2
                                        });
                                    });
                                }
                                if(result.data.branch){
                                    var clipboard1 = new ClipboardJS( _this.fuzhi[1]);
                                    clipboard1.on('success', function(e) {
                                        layer.open({
                                            content: '复制成功',skin: 'msg',time: 2
                                        });
                                    });
                                }
                                if(result.data.bankcard){
                                    var clipboard2 = new ClipboardJS( _this.fuzhi[2]);
                                    clipboard2.on('success', function(e) {
                                        layer.open({
                                            content: '复制成功',skin: 'msg',time: 2
                                        });
                                    });
                                }
                                if(result.data.wxcard){
                                    var clipboard3 = new ClipboardJS( _this.fuzhi[3]);
                                    clipboard3.on('success', function(e) {
                                        layer.open({
                                            content: '复制成功',skin: 'msg',time: 2
                                        });
                                    });
                                }
                                if(result.data.alicard){
                                    var clipboard4 = new ClipboardJS( _this.fuzhi[4]);
                                    clipboard4.on('success', function(e) {
                                        layer.open({
                                            content: '复制成功',skin: 'msg',time: 2
                                        });
                                    });
                                }
                                return;
                            }
                        }, function (result) {

                        });
                    });
                    //确认完成
                    $('.bills_list_mine .confrm').on('click', function(){
                        var orderNumber = $(this).attr('data-operate');
                        var sendData = {
                            'account':sessionStorage.account,
                            'order_no':orderNumber
                        };
                        var layerOpen =  layer.open({type: 2 ,shadeClose:false});
                        ajaxEve('post', server.market_confirmdeal, sendData, function (result) {
                            layer.close(layerOpen);
                            if (result.status == 200) {
                                layer.open({
                                    content: result.msg,skin: 'msg',time: 2
                                });
                                location.reload();
                                return;
                            }else{
                                layer.open({
                                    content: result.msg,skin: 'msg',time: 2
                                });
                            }
                        }, function (result) {
                            setTimeout(function(){
                                layer.close(layerOpen);
                            },1500);
                        });
                    });
                    //释放CLW
                    $('.bills_list_mine .release').on('click', function(){
                        var orderNumber = $(this).attr('data-operate');
                        var sendData = {
                            'account':sessionStorage.account,
                            'order_no':orderNumber
                        };
                        
                        layer.open({
                            title:'交易密码',
                            className: 'popuo-login',
                            content:'<div class="input-password"><input id="paypass" type="password" placeholder="请输入交易密码"></div>',
                            shadeClose:false,   //点击遮罩层是否关闭弹窗
                            btn: ['确定', '取消'],
                            yes: function(index){
                                _this.opwd = $('#paypass').val();
                                console.log(_this.opwd);
                                if (!_this.opwd) {
                                    layer.open({
                                        content: '请输入支付密码',skin: 'msg',time: 2
                                    });
                                    return false;
                                };
                                if (!_this.Password(_this.opwd)) {
                                    layer.open({
                                        content: '密码格式有误！',skin: 'msg',time: 2
                                    });
                                    return false;
                                };
                                _this.Submitdata = {
                                    'account':sessionStorage.account,
                                    'tpwd':_this.opwd
                                };
                                ajaxEve('post', server.shop_paypassword, _this.Submitdata, function (result) {
                                    if (result.status == 200) {
                                        ajaxEve('post', server.market_confirmdeal, sendData, function (result) {
                                            if (result.status == 200) {
                                                layer.open({
                                                    content: result.msg,skin: 'msg',time: 2
                                                });
                                                location.reload();
                                                return;
                                            }else{
                                                layer.open({
                                                    content: result.msg,skin: 'msg',time: 2
                                                });
                                            }
                                        }, function (result) {

                                        });
                                        return;
                                    }
                                }, function (result) {
                                    layer.open({
                                        content: result.msg,skin: 'msg',time: 2
                                    });
                                    return;
                                });

                            }
                        });
                    });
                    //取消订单
                    $('.bills_list_mine .cancel').on('click', function(){
                        var orderNumber = $(this).attr('data-operate');
                        var sendData = {
                            'account':sessionStorage.account,
                            'order_no':orderNumber
                        };
                        var layerOpen =  layer.open({type: 2 ,shadeClose:false});
                        ajaxEve('post', server.market_conceldeal, sendData, function (result) {
                            layer.close(layerOpen);
                            if (result.status == 200) {
                                layer.open({
                                    content: result.msg,skin: 'msg',time: 2
                                });
                                location.reload();
                                return;
                            }else{
                                layer.open({
                                    content: result.msg,skin: 'msg',time: 2
                                });
                            }
                        }, function (result) {
                            setTimeout(function(){
                                layer.close(layerOpen);
                            },1500);
                        });
                    });
                    //标记已付款
                    $('.bills_list_mine .sign').on('click', function(){
                        var orderNumber = $(this).attr('data-operate');
                        var sendData = {
                            'account':sessionStorage.account,
                            'order_no':orderNumber
                        };
                        var layerOpen =  layer.open({type: 2 ,shadeClose:false});
                        ajaxEve('post', server.market_signdeal, sendData, function (result) {
                            layer.close(layerOpen);
                            if (result.status == 200) {
                                layer.open({
                                    content: result.msg,skin: 'msg',time: 2
                                });
                                location.reload();
                                return;
                            }else{
                                layer.open({
                                    content: result.msg,skin: 'msg',time: 2
                                });
                            }
                        }, function (result) {
                            setTimeout(function(){
                                layer.close(layerOpen);
                            },1500);
                        });
                    });
                }
                return;
            }
        }, function (result) {

        });
    });
    

    //点对点挂单
    $('.dot-to-sell').on('click', function(){
        var name = $('#dot_name').val();
        var num = $('#dot_num').val();
        // var price = $('#dot_price').val();
        var pass = $('#dot_pass').val();

        if (!name) {
            layer.open({
                content: '请输入买家用户名',skin: 'msg',time: 2
            });
            return false;
        };
        if (!num) {
            layer.open({
                content: '请输入售出数量',skin: 'msg',time: 2
            });
            return false;
        };
        // if (!price) {
        //     layer.open({
        //         content: '请输入约定价格',skin: 'msg',time: 2
        //     });
        //     return false;
        // }
        if (!pass) {
            layer.open({
                content: '请输入交易密码',skin: 'msg',time: 2
            });
            return false;
        }
        if(_this.setPassOr == 0){
            // $('.tan-password').show();
            layer.open({
                className: 'popuo-login',
                content:'<p>您还未设置交易密码，是否前往设置</p>',
                shadeClose:false,   //点击遮罩层是否关闭弹窗
                btn: ['前往', '取消'],
                yes: function(){
                    window.location.href = './editpasswordpay.html';
                }
            });
            return false;
        };
        if(_this.setIdentifyOr == 1 || _this.setIdentifyOr == 4){
            // $('.tan-shiming').show();
            layer.open({
                className: 'popuo-login',
                content:'<p class="tips-content">您还未实名认证，是否前往实名认证</p>',
                shadeClose:false,   //点击遮罩层是否关闭弹窗
                btn: ['前往', '取消'],
                yes: function(){
                    window.location.href = './identify.html';
                }
            });
            return false;
        };
        if(_this.setIdentifyOr == 2){
            layer.open({
                className: 'popuo-login',
                content:'<p class="tips-content">您的实名认证正在审核中</p>',
                shadeClose:false,   //点击遮罩层是否关闭弹窗
                btn: ['前往查看', '取消'],
                yes: function(){
                    window.location.href = './persondata.html';
                }
            });
            return false;
        };
        if(!_this.setPayWayAil && !_this.setPayWayBank && !_this.setPayWayWx){
            layer.open({
                className: 'popuo-login',
                content:'<p class="tips-content">您还未设置支付方式，是否前往设置</p>',
                shadeClose:false,   //点击遮罩层是否关闭弹窗
                btn: ['前往', '取消'],
                yes: function(){
                    window.location.href = './modepayment.html';
                }
            });
            return false;
        };
        _this.Submitdata = {
            'account':sessionStorage.account,
            "o_account":name,
            // 'price':price,
            'total_num':num,
            'tpwd':pass
        };
        var layerOpen =  layer.open({type: 2 ,shadeClose:false});
        ajaxEve('post', server.market_dotToDotPull, _this.Submitdata, function (result) {
            layer.close(layerOpen);
            if (result.status == 200) {
                transaction(result.data.o_account,result.data.total_num,result.data.realname);
                return;
            } 
        }, function (result) {
            layer.open({
                content: result.msg,skin: 'msg',time: 2
            });
            setTimeout(function(){
                layer.close(layerOpen);
            },1500);
            return;
        });

    });
    function transaction(name,num,name1){
        layer.open({
            className: 'popuo-login',
            content:'<p class="tips-content" style="color:#fff">您将转给'+name1+','+num+'CLW</p>'+
                '<section class="register">'+
                    '<label>短信验证码</label>'+
                    '<input type="number" name="code" placeholder="请输入短信验证码">'+
                    '<div class="VerificationCode">获取验证码</div>'+
                '</section>',
            shadeClose:false,   //点击遮罩层是否关闭弹窗
            type:"0",
            btn: ['确定', '取消'],
            yes: function(index){
                _this.code = document.getElementsByName('code')[0].value;
                if(!_this.code){
                    layer.open({
                        content: '验证码不能为空！',skin: 'msg',time: 2 ,type:"0",
                    });
                    return false;
                };
                _this.Submitdata1 = {
                    o_account:name,
                    total_num:num,
                    code:_this.code
                };
                var layeropen1 = layer.open({type: 2 ,shadeClose:false});
                ajaxEve('post', server.market_dotToDotPullconfirm, _this.Submitdata1, function (result) {
                    layer.close(layeropen1);
                    if (result.status == 200) {
                        layer.open({
                            className: 'popuo-login',
                            content:'<div class="censd">'+
                                '<h2 class="img"></h2>'+
                                '<p class="rer">'+_this.realname+'于'+result.data.finish_time+'转给'+name1+num+'个CLW，已到账'+'</p>'+
                                '</div>',
                            shadeClose:false,   //点击遮罩层是否关闭弹窗
                            type:"0",
                            btn: ['确定', '取消'],
                            yes:function(index){
                                layer.close(index);
                            },
                        });
                        return;
                    };
                }, function (result) {
                    layer.open({
                        content: result.msg,skin: 'msg',time: 2,type:"0",
                    });
                    return;
                });
            },success: function(elem){
                document.getElementsByClassName("VerificationCode")[0].onclick = function(){
                    if(countdowntype){
                        countdowntype = false;
                    }else {
                        return false;
                    }
                    var layeropen1 = layer.open({type: 2 ,shadeClose:false});
                    $.get(server.send_sms,{'mobile':_this.mobile1,'type':'3'},function(response){
                        layer.close(layeropen1);
                        if(response.status == '200'){
                            var layeropen2 = layer.open({
                                content: '短信验证码已发送到手机请注意查收',type:"0",skin: 'msg',time: 2 
                            });
                            _this.mobile1 = _this.mobile;
                            countdown();
                        }else {
                            countdowntype = true;
                            var layeropen2 = layer.open({
                                content: response.msg,type:"0",skin: 'msg',time: 2 
                            });
                        };
                    });
                };
            },end:function(){
                clearInterval(countdowntime);
            }
        });
    }
    //点对点挂单记录
    $('#get-recode').on('click', function(){
        var dovMineRecode = $('.content_recode');
        var dovbooyMineRecode = $('#content_recode');
        ajaxEve('post', server.market_recode, {account:sessionStorage.account}, function (result) {
            if (result.status == 200) {
                if(result.data){
                    jo.reTpl(dovbooyMineRecode,result,dovMineRecode);
                    var orderNumber = result.data.order_no;
                    //申诉
                    $('.bills_list_recode .appeal').on('click', function(){
                        $(".tan-shensu").show();
                        $(".shensu-btn").on('click', function(){
                            var reason = $(".reason").val();
                            var type = $('#shensu-type').val();
                            if (!reason) {
                                layer.open({
                                    content: '请输入申诉理由',skin: 'msg',time: 2
                                });
                                return false;
                            }
                            var senData = {
                                'account':sessionStorage.account,
                                'order_no':orderNumber,
                                'ss_reason':reason,
                                'type':type
                            };
                            var layerOpen =  layer.open({type: 2 ,shadeClose:false});
                            ajaxEve('post', server.market_shensu, senData, function (result) {
                                layer.close(layerOpen);
                                if (result.status == 200) {
                                    layer.open({
                                        content: result.msg,skin: 'msg',time: 2
                                    });
                                    setTimeout(function(){location.reload();},2000);
                                    return;
                                }else{
                                    layer.open({
                                        content: result.msg,skin: 'msg',time: 2
                                    });
                                }
                            }, function (result) {
                                setTimeout(function(){
                                    layer.close(layerOpen);
                                },1500);
                            });
                        });
                    });
                    //卖家信息
                    $('.bills_list_recode .information').on('click', function(){
                        var dovDe = $('.tan-detail');
                        var dovbooyDe = $('#tan-detail');
                        $(".tan-buyer-detail").show();
                        var sendData = {
                            'account':sessionStorage.account,
                            'order_no':orderNumber
                        };
                        ajaxEve('post', server.market_sellerdetail, sendData, function (result) {
                            if (result.status == 200) {
                                jo.reTpl(dovbooyDe,result,dovDe);
                                _this.fuzhi = $('.fuzhi');
                                if(result.data.realname){
                                    var clipboard0 = new ClipboardJS( _this.fuzhi[0]);
                                    clipboard0.on('success', function(e) {
                                        layer.open({
                                            content: '复制成功',skin: 'msg',time: 2
                                        });
                                    });
                                }
                                if(result.data.branch){
                                    var clipboard1 = new ClipboardJS( _this.fuzhi[1]);
                                    clipboard1.on('success', function(e) {
                                        layer.open({
                                            content: '复制成功',skin: 'msg',time: 2
                                        });
                                    });
                                }
                                if(result.data.bankcard){
                                    var clipboard2 = new ClipboardJS( _this.fuzhi[2]);
                                    clipboard2.on('success', function(e) {
                                        layer.open({
                                            content: '复制成功',skin: 'msg',time: 2
                                        });
                                    });
                                }
                                if(result.data.wxcard){
                                    var clipboard3 = new ClipboardJS( _this.fuzhi[3]);
                                    clipboard3.on('success', function(e) {
                                        layer.open({
                                            content: '复制成功',skin: 'msg',time: 2
                                        });
                                    });
                                }
                                if(result.data.alicard){
                                    var clipboard4 = new ClipboardJS( _this.fuzhi[4]);
                                    clipboard4.on('success', function(e) {
                                        layer.open({
                                            content: '复制成功',skin: 'msg',time: 2
                                        });
                                    });
                                }
                                return;
                            }
                        }, function (result) {

                        });
                    });
                    //确认完成
                    $('.bills_list_recode .confrm').on('click', function(){
                        var sendData = {
                            'account':sessionStorage.account,
                            'order_no':orderNumber
                        };
                        var layerOpen =  layer.open({type: 2 ,shadeClose:false});
                        ajaxEve('post', server.market_confirmdeal, sendData, function (result) {
                            layer.close(layerOpen);
                            if (result.status == 200) {
                                layer.open({
                                    content: result.msg,skin: 'msg',time: 2
                                });
                                location.reload();
                                return;
                            }else{
                                layer.open({
                                    content: result.msg,skin: 'msg',time: 2
                                });
                            }
                        }, function (result) {
                            setTimeout(function(){
                                layer.close(layerOpen);
                            },1500);
                        });
                    });
                    //释放CLW
                    $('.bills_list_recode .release').on('click', function(){
                        var sendData = {
                            'account':sessionStorage.account,
                            'order_no':orderNumber
                        };
                        layer.open({
                            title:'交易密码',
                            className: 'popuo-login',
                            content:'<div class="input-password"><input id="paypass" type="password" placeholder="请输入交易密码"></div>',
                            shadeClose:false,   //点击遮罩层是否关闭弹窗
                            btn: ['确定', '取消'],
                            yes: function(index){
                                _this.opwd = $('#paypass').val();
                                console.log(_this.opwd);
                                if (!_this.opwd) {
                                    layer.open({
                                        content: '请输入支付密码',skin: 'msg',time: 2
                                    });
                                    return false;
                                };
                                if (!_this.Password(_this.opwd)) {
                                    layer.open({
                                        content: '密码格式有误！',skin: 'msg',time: 2
                                    });
                                    return false;
                                };
                                _this.Submitdata = {
                                    'account':sessionStorage.account,
                                    'tpwd':_this.opwd
                                };
                                var layerOpen =  layer.open({type: 2 ,shadeClose:false});
                                ajaxEve('post', server.shop_paypassword, _this.Submitdata, function (result) {
                                    layer.close(layerOpen);
                                    if (result.status == 200) {
                                        var layerOpen =  layer.open({type: 2 ,shadeClose:false});
                                        ajaxEve('post', server.market_confirmdeal, sendData, function (result) {
                                            layer.close(layerOpen);
                                            if (result.status == 200) {
                                                layer.open({
                                                    content: result.msg,skin: 'msg',time: 2
                                                });
                                                location.reload();
                                                return;
                                            }else{
                                                layer.open({
                                                    content: result.msg,skin: 'msg',time: 2
                                                });
                                            }
                                        }, function (result) {
                                            setTimeout(function(){
                                                layer.close(layerOpen);
                                            },1500);
                                        });

                                        return;
                                    }
                                }, function (result) {
                                    layer.open({
                                        content: result.msg,skin: 'msg',time: 2
                                    });
                                    setTimeout(function(){
                                        layer.close(layerOpen);
                                    },1500);
                                    return;
                                });

                            }
                        });

                    });
                    //取消订单
                    $('.bills_list_recode .cancel').on('click', function(){
                        var sendData = {
                            'account':sessionStorage.account,
                            'order_no':orderNumber
                        };
                        var layerOpen =  layer.open({type: 2 ,shadeClose:false});
                        ajaxEve('post', server.market_conceldeal, sendData, function (result) {
                            layer.close(layerOpen);
                            if (result.status == 200) {
                                layer.open({
                                    content: result.msg,skin: 'msg',time: 2
                                });
                                location.reload();
                                return;
                            }else{
                                layer.open({
                                    content: result.msg,skin: 'msg',time: 2
                                });
                            }
                        }, function (result) {
                            setTimeout(function(){
                                layer.close(layerOpen);
                            },1500);
                        });
                    });
                    //标记已付款
                    $('.bills_list_recode .sign').on('click', function(){
                        var sendData = {
                            'account':sessionStorage.account,
                            'order_no':orderNumber
                        };
                        var layerOpen =  layer.open({type: 2 ,shadeClose:false});
                        ajaxEve('post', server.market_signdeal, sendData, function (result) {
                            layer.close(layerOpen);
                            if (result.status == 200) {
                                layer.open({
                                    content: result.msg,skin: 'msg',time: 2
                                });
                                location.reload();
                                return;
                            }else{
                                layer.open({
                                    content: result.msg,skin: 'msg',time: 2
                                });
                            }
                        }, function (result) {
                            setTimeout(function(){
                                layer.close(layerOpen);
                            },1500);
                        });
                    });
                }
                return;
            }
        }, function (result) {

        });
    });


};

//挂单须知
networking.prototype.needKnow = function(){
    var dov = $('.know-content');
    var dovbooy = $('#know-content');
    var sendData = {'type':1};
    ajaxEve('post', server.market_needknow, {}, function (result) {
        if (result.status == 200) {
            jo.reTpl(dovbooy,result,dov);
            return;
        }
    }, function (result) {

    });
};

//点对点须知
networking.prototype.needKnow1 = function(){
    var dov = $('.know-content');
    var dovbooy = $('#know-content');
    var sendData = {'type':5};
    ajaxEve('post', server.market_needknow, sendData, function (result) {
        if (result.status == 200) {
            jo.reTpl(dovbooy,result,dov);
            return;
        }
    }, function (result) {

    });
};








//我的
networking.prototype.mine = function(){
    var _this = this;
    //首页
    _this.myProperty = $('.content-property .content-property1');
    _this.loginTips = $('.login-tips');
    _this.mineList = $('.mine-list .list-item');
    if(accontdata && tokendata){
        _this.myProperty.show();
        $(_this.mineList[0]).on('click',function(){
            location.href = './persondata.html';
        });
        $(_this.mineList[1]).on('click',function(){
            location.href = './property.html';
        });
        $(_this.mineList[2]).on('click',function(){
            location.href = './modepayment.html';
        });
        $(_this.mineList[3]).on('click',function(){
            location.href = './myorder.html';
        });
        $(_this.mineList[4]).on('click',function(){
            location.href = './myteam.html';
        });
        $(_this.mineList[5]).on('click',function(){
            $('.tan').show();
        });
    }else{
        _this.mineList.on('click', function(){
            loginState();
        });
        _this.loginTips.show();
    }
    var dovall = $('.content-property1');
    var dovbooyall = $('#content-property1');
    _this.account = sessionStorage.account;
    _this.type = '';
    var sendData = {
        'account': _this.account,
        'type':_this.type
    };
    ajaxEve('post', server.mine_myproperty, sendData, function (result) {
        if (result.status == 200) {
            jo.reTpl(dovbooyall,result,dovall);
        }
    }, function (result) {
    });

    //获取用户名和等级
    ajaxEve('POST', server.user_info, {}, function (result) {
            if (result.status == 200) {
                var dov = $('.header_box');
                var dovbooy = $('#header_box');
                jo.reTpl(dovbooy,result,dov);
                status = result.data.status;
            }
        },
        function (result) {

        });

};


//弹框隐藏/复制
networking.prototype.tanOrCopy = function(){
  var _this = this;
  _this.quxiao = $('.quxiao');
  _this.fuzhi = $('.fuzhi');
  _this.tanWindow = $('.tan');
  _this.quxiao.on('click', function(){
      _this.tanWindow.hide();
    });
    var clipboard = new ClipboardJS(_this.fuzhi[0]);
    clipboard.on('success', function(e) {
        layer.open({
            content: '复制成功',skin: 'msg',time: 2
        });
    });

};

//用户实名认证
networking.prototype.identify = function(){
    let _this = this;
    var imgurl1,imgurl2,uploader1,uploader2;
    Pictureupload(uploader1,'.filePicker',imgurl1);
    Pictureupload(uploader2,'.filePicker1',imgurl2);

    $('.identify-btn').on('click', function(){
        var formData = new FormData();
        _this.realname = $('.realname').val();
        _this.idcard = $('.idcard-num').val();
        _this.idcard1 = $('.judge-or').attr('data-up');
        _this.idcard2 = $('.judge-or1').attr('data-up');
        // _this.imgUrl1 = imgurl1;
        // _this.imgUrl2 = imgurl2;
        if (!_this.realname) {
            layer.open({
                content: '请输入您的真实姓名',skin: 'msg',time: 2
            });
            return false;
        };
        if (_this.realname.length > 5) {
            layer.open({
                content: '请输入您的真实姓名',skin: 'msg',time: 2
            });
            return false;
        };
        if (!_this.idcard) {
            layer.open({
                content: '请输入您的身份证号',skin: 'msg',time: 2
            });
            return false;
        };
        if (!_this.isCardNo(_this.idcard)) {
            layer.open({
                content: '请输正确的身份证号',skin: 'msg',time: 2
            });
            return false;
        };
        if (_this.idcard1 == 'false') {
            layer.open({
                content: '请上传您的身份证正面照',skin: 'msg',time: 2
            });
            return false;
        };
        if (_this.idcard2 == 'false') {
            layer.open({
                content: '请上传您的身份证反面照',skin: 'msg',time: 2
            });
            return false;
        };
        layer.open({type: 2 ,shadeClose:false});
        _this.imgUrl1 = $('.judge-or').attr('src').split(url)[1].substr(1);
        _this.imgUrl2 = $('.judge-or1').attr('src').split(url)[1].substr(1);
        let sendData = {
            'realname':_this.realname,
            'idcard':_this.idcard,
            'card1':_this.imgUrl1,
            'card2':_this.imgUrl2
        };
        var layerOpen = layer.open({type: 2 ,shadeClose:false});
        ajaxEve('post', server.mine_identify, sendData, function (result) {
            layer.close(layerOpen);
            if (result.status == 200) {
                layer.open({
                    content: result.msg,skin: 'msg',time: 2
                });
                setTimeout(function(){
                    // window.history.go(-1);
                    window.location.replace('./persondata.html');
                },1000);
                return;

            } else if (result.status == 0) {
                layer.open({
                    content: result.msg,skin: 'msg',time: 2
                });
            }
        }, function (result) {
            layer.open({
                content: result.msg,skin: 'msg',time: 2
            });
            setTimeout(function(){
                layer.close(layerOpen);
            },1500);
            return;
        });
    })
};

function Pictureupload(name,classtype,datashuju){
    name = WebUploader.create({// 选完文件后，是否自动上传。
        auto: true,// swf文件路径
        swf: 'Uploader.swf',// 文件接收服务端。
        server: server.uploadImg,// 选择文件的按钮。可选。
        pick: classtype,
        resize: true,// 只允许选择图片文件。
        accept: {
            title: 'Images',
            extensions: 'gif,jpg,jpeg,bmp,png',
            mimeTypes: 'image/*'
        }
    });
    // 当有文件添加进来的时候
    name.on( 'fileQueued', function( file) {
        layer.open({type: 2 ,shadeClose:false});
    });
     // 文件上传成功，给item添加成功class, 用样式标记上传成功。
    name.on( 'uploadSuccess', function( file ,data) {
        layer.closeAll();
        if(data.status == 200){
            layer.open({
                content: '上传成功',skin: 'msg',time: 2
            });
            datashuju = data.url;
            $(classtype).prev('img').attr('src',url+'/'+datashuju);
            $(classtype).prev('img').attr('data-up',true);
            if($(classtype).prev('img').length == 1){
                $('.up_bg').hide();
                $('.up_wenzi').hide();
                $('.up_img').css({'display':'flex','justify-content': 'center'})
                $('.judge-or').show();
                $('.judge-wei').show();
            }else {

            }

        }else {
            layer.open({
                content: '上传失败',skin: 'msg',time: 2
            });
        }
    });
    // 文件上传失败，显示上传出错。
    name.on( 'uploadError', function( file ) {
        layer.closeAll();
        layer.open({
                content: '图片上传失败',skin: 'msg',time: 2
            });
    });
};
//修改登录密码
networking.prototype.editpassword = function(){
    let _this = this;
    ajaxEve('post', server.user_info, {}, function (result) {
        if (result.status == 200) {
            $('.username').val(result.data.user_login);
            $('.telephone').val(result.data.mobile);
        }
    }, function (result) {
        return;
    });

    $('.username').val(_this.userinfo)
    //获取验证码
    $('.VerificationCode').on('click', function(){
        _this.mobile  = $('.telephone').val();
        if(countdowntype){
            countdowntype = false;
        }else {
            return false;
        };
        if (!_this.mobile) {
            layer.open({
                content: '手机号不能为空！',skin: 'msg',time: 2
            });
            countdowntype = true;
            return false;
        };
        if (!_this.checkMobile(_this.mobile)) {
            layer.open({
                content: '手机号格式有误！',skin: 'msg',time: 2
            });
            countdowntype = true;
            return false;
        };
        layer.open({type: 2 ,shadeClose:false});
        $.get(server.send_sms,{'mobile':_this.mobile,'type':'2'},function(response){
            layer.closeAll();
            if(response.status == '200'){
                layer.open({
                    content: '短信验证码已发送到手机请注意查收',skin: 'msg',time: 2
                });
                _this.mobile1 = _this.mobile;
                countdown();
            }else {
                countdowntype = true;
                layer.open({
                    content: response.msg,skin: 'msg',time: 2
                });
            };
        });
    });
    $('.editpassword-btn').on('click', function(){
        _this.userlogin  = $('.username').val();
        _this.mobile  = $('.telephone').val();
        _this.code = $('.codema').val();
        _this.opwd = $('.new-password').val();
        _this.topwd = $('.password-config').val();
        if (!_this.mobile) {
            layer.open({
                content: '手机号不能为空！',skin: 'msg',time: 2
            });
            return false;
        };
        if (!_this.checkMobile(_this.mobile)) {
            layer.open({
                content: '手机号格式有误！',skin: 'msg',time: 2
            });
            return false;
        };
        if(_this.mobile1 != _this.mobile){
            layer.open({
                content: '验证码有误！',skin: 'msg',time: 2
            });
            return false;
        };
        if (!_this.Password(_this.opwd)) {
            layer.open({
                content: '密码格式有误！',skin: 'msg',time: 2
            });
            return false;
        };
        if (_this.opwd != _this.topwd) {
            layer.open({
                content: '两次密码格式不一致！',skin: 'msg',time: 2
            });
            return false;
        };
        _this.Submitdata = {
            "user_login":_this.userlogin,
            'mobile':_this.mobile,
            'opwd':_this.opwd,
            'opwd1':_this.topwd,
            'code':_this.code,
        };
       var layerOpen =  layer.open({type: 2 ,shadeClose:false});
        ajaxEve('post', server.mine_editpassword, _this.Submitdata, function (result) {
            layer.close(layerOpen);
            if (result.status == 200) {
                layer.open({
                    content:result.msg,skin: 'msg',time: 2
                });
                setTimeout(function(){
                    window.location.replace('./signin.html');
                },1500);
                return;
            }
        }, function (result) {
            layer.open({
                content: result.msg,skin: 'msg',time: 2
            });
            setTimeout(function(){
                layer.close(layerOpen);
            },1500);
            return;
        });
    })
};

//修改资金密码
networking.prototype.editpasswordpay = function(){
    if(sessionStorage.hasSetPass){
        let getUserName = JSON.parse(sessionStorage.hasSetPass);
        $('.username').val(getUserName.name);
        $('.telephone').val(getUserName.tele);
    }else{
        $('.header_box .content').html('设置支付密码');
        ajaxEve('post', server.user_info, {}, function (result) {
            if (result.status == 200) {
                $('.username').val(result.data.user_login);
                $('.telephone').val(result.data.mobile);
            }
        }, function (result) {
            return;
        });
    }
    let _this = this;
    //获取验证码
    $('.VerificationCode').on('click', function(){
        _this.mobile  = $('.telephone').val();
        if(countdowntype){
            countdowntype = false;
        }else {
            return false;
        };
        if (!_this.mobile) {
            layer.open({
                content: '手机号不能为空！',skin: 'msg',time: 2
            });
            countdowntype = true;
            return false;
        };
        if (!_this.checkMobile(_this.mobile)) {
            layer.open({
                content: '手机号格式有误！',skin: 'msg',time: 2
            });
            countdowntype = true;
            return false;
        };
        layer.open({type: 2 ,shadeClose:false});
        $.get(server.send_sms,{'mobile':_this.mobile,'type':'2'},function(response){
            layer.closeAll();
            if(response.status == '200'){
                layer.open({
                    content: '短信验证码已发送到手机请注意查收',skin: 'msg',time: 2
                });
                _this.mobile1 = _this.mobile;
                countdown();
            }else {
                countdowntype = true;
                layer.open({
                    content: response.msg,skin: 'msg',time: 2
                });
            };
        });
    });
    $('.editpassword-btn').on('click', function(){
        _this.userlogin  = $('.username').val();
        _this.mobile  = $('.telephone').val();
        _this.code = $('.codema').val();
        _this.opwd = $('.new-password').val();
        _this.topwd = $('.password-config').val();
        if (!_this.userlogin) {
            layer.open({
                content: '用户名不能为空！',skin: 'msg',time: 2
            });
            return false;
        };
        if (!_this.UserLogin(_this.userlogin)) {
            layer.open({
                content: '用户名格式有误！',skin: 'msg',time: 2
            });
            return false;
        };
        if (!_this.mobile) {
            layer.open({
                content: '手机号不能为空！',skin: 'msg',time: 2
            });
            return false;
        };
        if (!_this.checkMobile(_this.mobile)) {
            layer.open({
                content: '手机号格式有误！',skin: 'msg',time: 2
            });
            return false;
        };
        if(_this.mobile1 != _this.mobile){
            layer.open({
                content: '验证码有误！',skin: 'msg',time: 2
            });
            return false;
        };
        if (!_this.Password(_this.opwd)) {
            layer.open({
                content: '密码格式有误！',skin: 'msg',time: 2
            });
            return false;
        };
        if (_this.opwd != _this.topwd) {
            layer.open({
                content: '两次密码格式不一致！',skin: 'msg',time: 2
            });
            return false;
        };
        _this.Submitdata = {
            "user_login":_this.userlogin,
            'mobile':_this.mobile,
            'tpwd':_this.opwd,
            'tpwd1':_this.topwd,
            'code':_this.code,
        };
        var layerOpen =  layer.open({type: 2 ,shadeClose:false});
        ajaxEve('post', server.mine_editpasswordpay, _this.Submitdata, function (result) {
            layer.close(layerOpen);
            if (result.status == 200) {
                layer.open({
                    content:result.msg,skin: 'msg',time: 2
                });
                setTimeout(function(){
                    _this.lastHref = document.referrer;
                    window.location.href = _this.lastHref;
                },1500);
                return;
            } else if (result.status == 0) {
                layer.open({
                    content: result.msg,skin: 'msg',time: 2
                });
            }
        }, function (result) {
            layer.open({
                content: result.msg,skin: 'msg',time: 2
            });
            setTimeout(function(){
                layer.close(layerOpen);
            },1500);
            return;
        });
    })
};
//地址管理
networking.prototype.address = function(){
    var dov = $('.address-list .list-lists');
    var dovbooy = $('#address-list');
    var _this = this;
    var sendData = {
        'page':1,
        'size':''
    };
    ajaxEve('post', server.mine_address, sendData, function (result) {
        if (result.status == 200) {
            jo.reTpl(dovbooy,result,dov);

        }
    }, function (result) {
    });
    //设置默认/取消默认
    $('body').on('click','.moreren', function(){
        var thisId = $(this).attr('data-id');
        var sendDataId = {'id':thisId};
        var layerOpen =  layer.open({type: 2 ,shadeClose:false});
        ajaxEve('post', server.mine_morenor, sendDataId, function (result) {
            layer.close(layerOpen);
            if (result.status == 200) {
                layer.open({
                    content:result.msg,skin: 'msg',time: 2
                });
                setTimeout(function(){
                    ajaxEve('post', server.mine_address, sendData, function (result) {
                        if (result.status == 200) {
                            jo.reTpl(dovbooy,result,dov);

                        }
                    }, function (result) {
                    });
                },1500);
            }else{
                layer.open({
                    content:result.msg,skin: 'msg',time: 2
                });
            }
        }, function (result) {
            setTimeout(function(){
                layer.close(layerOpen);
            },1500)
        });
    });

    //删除地址
    $('body').on('click','.delete',function(){
        var thisId = $(this).attr('data-id');
        var sendDataId = {'id':thisId};
        var layerOpen =  layer.open({type: 2 ,shadeClose:false});
        ajaxEve('post', server.mine_deleteaddress, sendDataId, function (result) {
            layer.close(layerOpen);
            if (result.status == 200) {
                layer.open({
                    content:result.msg,skin: 'msg',time: 2
                });
                setTimeout(function(){
                    ajaxEve('post', server.mine_address, sendData, function (result) {
                        if (result.status == 200) {
                            jo.reTpl(dovbooy,result,dov);

                        }
                    }, function (result) {
                    });
                },1500);
            }else{
                layer.open({
                    content:result.msg,skin: 'msg',time: 2
                });
            }
        }, function (result) {
            setTimeout(function(){
                layer.close(layerOpen);
            },1500)
        });
    });

    //监听返回
    $('#Return').on('click', function(){
        if(addresstype == "1"){
            window.location.href = "goodsbuy.html";
        }else {
            window.location.href = "persondata.html";
        }
    });
};

//添加地址
networking.prototype.addressadd = function(){
    var _this = this;
    var hrefId = location.href.split('?')[1];
    if(hrefId){
        $('.addressadd .content').html('编辑地址');
        var sendId = hrefId.split('=')[1];
        //获取地址详情
        var getAddressDetail = {'id':sendId};
        ajaxEve('post', server.mine_detaildress, getAddressDetail, function (result) {
            if (result.status == 200) {
                $('.get-name').val(result.data.name);
                $('.get-tele').val(result.data.mobile);
                $('.province').val(result.data.sheng);
                $('.shi').val(result.data.shi);
                $('.addresss').html(result.data.address);
            }
        }, function (result) {
        });
        //编辑地址
        $(".addressadd-btn").on('click', function(){
            _this.name = $('.get-name').val();
            _this.mobile = $('.get-tele').val();
            _this.sheng = $('.province').val();
            _this.shi = $('.city').val();
            _this.address = $('.addresss').val();
            if (!_this.name) {
                layer.open({
                    content: '请输入姓名！',skin: 'msg',time: 2
                });
                return false;
            };
            if (!_this.mobile) {
                layer.open({
                    content: '请输入手机号！',skin: 'msg',time: 2
                });
                return false;
            };
            if (!_this.checkMobile(_this.mobile)) {
                layer.open({
                    content: '手机号格式有误！',skin: 'msg',time: 2
                });
                return false;
            };
            if (!_this.address) {
                layer.open({
                    content: '请输入详细地址！',skin: 'msg',time: 2
                });
                return false;
            };
            var sendData = {
                'id':sendId,
                'name':_this.name,
                'mobile':_this.mobile,
                'sheng':_this.sheng,
                'shi':_this.shi,
                'address':_this.address
            };
            var layerOpen = layer.open({type: 2 ,shadeClose:false});
            ajaxEve('post', server.mine_editdress, sendData, function (result) {
                layer.close(layerOpen);
                if (result.status == 200) {
                    layer.open({
                        content: result.msg,skin: 'msg',time: 2
                    });
                    setTimeout(function(){
                        _this.lastHref = document.referrer;
                        window.location.replace(_this.lastHref);
                    },1500);
                }else{
                    layer.open({
                        content: result.msg,skin: 'msg',time: 2
                    });
                }
            }, function (result) {
                setTimeout(function(){
                    layer.close(layerOpen);
                },1500);
            });
        });
    }else{
        $(".addressadd-btn").on('click', function(){
            _this.name = $('.get-name').val();
            _this.mobile = $('.get-tele').val();
            _this.sheng = $('.province').val();
            _this.shi = $('.city').val();
            _this.address = $('.addresss').val();
            if (!_this.name) {
                layer.open({
                    content: '请输入姓名！',skin: 'msg',time: 2
                });
                return false;
            };
            if (!_this.mobile) {
                layer.open({
                    content: '请输入手机号！',skin: 'msg',time: 2
                });
                return false;
            };
            if (!_this.checkMobile(_this.mobile)) {
                layer.open({
                    content: '手机号格式有误！',skin: 'msg',time: 2
                });
                return false;
            };
            if (!_this.address) {
                layer.open({
                    content: '请输入详细地址！',skin: 'msg',time: 2
                });
                return false;
            };
            var sendData = {
                'name':_this.name,
                'mobile':_this.mobile,
                'sheng':_this.sheng,
                'shi':_this.shi,
                'address':_this.address
            };
            var layerOpen = layer.open({type: 2 ,shadeClose:false});
            ajaxEve('post', server.mine_addressadd, sendData, function (result) {
                layer.close(layerOpen);
                if (result.status == 200) {
                    layer.open({
                        content: result.msg,skin: 'msg',time: 2
                    });
                    setTimeout(function(){
                        _this.lastHref = document.referrer;
                        window.location.replace(_this.lastHref);
                    },1500);
                }else{
                    layer.open({
                        content: result.msg,skin: 'msg',time: 2
                    });
                }
            }, function (result) {
                setTimeout(function(){
                    layer.close(layerOpen);
                },1500);
            });
        })
    }

};

//资产管理
networking.prototype.poperty = function(){
    var page=1,size=12,datas=null,status=true;
    var _this = this;
    _this.propertydetailTab = $('.propertydetail-tab li');
    var dov = $('.propertydetail-list');
    var dovbooy = $('#propertydetail-list');
    var dovall = $('.content-property');
    var dovbooyall = $('#content-property');
    _this.account = sessionStorage.account;
    _this.type = '';
    var sendData = {
        'account': _this.account,
        'type':_this.type,
        'page':1,
        'size':12
    };
    ajaxEve('post', server.mine_myproperty, sendData, function (result) {
        if (result.status == 200) {
            datas=result.data;
            if(result.data.list.length == 12){
                $('.pull-down1').show();
                $('.pull-down2').hide();
            }
            if(result.data.list.length == 0){
                $('.pull-down2').show();
                $('.pull-down1').hide();
            }
            jo.reTpl(dovbooy,datas,dov);
            jo.reTpl(dovbooyall,result,dovall);
        }
    }, function (result) {
    });

    //切换类型
    _this.propertydetailTab.on('click', function(){
        $('.pull-down1').hide();
        $('.pull-down2').hide();
        page=1;
        datas=null;
        status=true;
        _this.propertydetailTab.removeClass('active');
        $(this).addClass('active');
        _this.type = $(this).attr('data-type');
        var sendData = {
            'account': _this.account,
            'type':_this.type,
            'size':12,
            'page':page
        };
        ajaxEve('post', server.mine_myproperty, sendData, function (result) {
            if (result.status == 200) {
                datas=result.data;
                if(result.data.list.length == 12){
                    $('.pull-down1').show();
                }
                if(result.data.list.length == 0){
                    $('.pull-down2').show();
                }
                jo.reTpl(dovbooy,datas,dov);
                jo.reTpl(dovbooyall,result,dovall);
            }
        }, function (result) {
        });
    });

    //滚动事件触发
    window.onscroll = function() {
        if(_this.getScrollTop() + _this.getClientHeight() == _this.getScrollHeight()) {
            if(status){
                status=false;
                page+=1;
                var sendData = {
                    'account': _this.account,
                    'type':_this.type,
                    'size':12,
                    'page':page
                };
                ajaxEve('post', server.mine_myproperty, sendData, function (result) {
                    if (result.status == 200) {
                        if(result.data.list.length>0){
                            for(var i=0;i<result.data.list.length;i++){
                                datas.list.push(result.data.list[i]);
                            }
                            setTimeout(function(){
                                jo.reTpl(dovbooy,datas,dov);
                            },1000);
                            status=true;
                        }else{
                            status=false;
                            $('.pull-down1').hide();
                            $('.pull-down2').show();
                        }

                    }
                }, function (result) {
                });
            }
        }
    }

};


//我的团队
networking.prototype.myteam = function(){
    var dov = $('.team-list .list-lists');
    var dovbooy = $('#list-lists');
    var dovall = $('.team-list .total-content');
    var dovbooyall = $('#total-content');
    var _this = this;
    ajaxEve('post', server.mine_myteam, {}, function (result) {
        if (result.status == 200) {
            jo.reTpl(dovbooy,result.data,dov);
            jo.reTpl(dovbooyall,result,dovall);
        }
    }, function (result) {
    });
};

//查看团队
networking.prototype.myteamlook = function(){
    var dov = $('.team-list');
    var dovbooy = $('#team-list');
    var _this = this;
    _this.hrefId = location.href.split('?')[1].split('=')[1];
    var senData = {user_id:_this.hrefId};
    ajaxEve('post', server.mine_myteam,senData, function (result) {
        if (result.status == 200) {
            jo.reTpl(dovbooy,result.data,dov);
        }
    }, function (result) {
    });
};

//用户信息(个人资料使用)
networking.prototype.userInfo = function () {
    var _this = this;
    _this.whether = $('.content-item .whether');
    let status = '';
    ajaxEve('POST', server.user_info, {}, function (result) {
            if (result.status == 200) {
                var dov = $('.persondata-content1');
                var dovbooy = $('#persondata-content');
                jo.reTpl(dovbooy,result.data,dov);
                status = result.data.status;
                //是否可以实名认证
                $('.content-item').on('click','.whether', function(){
                    if(status == 1 || status == 4){
                        $(location).attr('href', 'identify.html');
                    }
                });
                if(status == 2){
                    $('.audit-now').show();
                    $('.audit-now-or').hide();
                }
                if(status == 3){
                    $('.identified-have').show();
                    $('.audit-now-or').hide();
                };
                $('.address-transfer-hide').click(function(){
                    window.sessionStorage.addresstype = "2";
                    window.location.href = "address.html";
                });
                //设置资金密码还是修改资金密码
                var setPassPayOr = result.data.has_tpwd;
                if(setPassPayOr == 1){
                    let getUserName = {
                        name:result.data.user_login,
                        tele:result.data.mobile,
                    };
                    sessionStorage.hasSetPass = JSON.stringify(getUserName);
                }
            }
        },
        function (result) {
            layer.open({
                content: result.msg,skin: 'msg',time: 2
            });
            return;
        });
        // 退出登录
    $('.exit').on('click', function(){
        sessionStorage.clear();
        setTimeout(function(){
            location.replace('./signin.html');
        });
    });
};



//用户信息（收款方式使用）
networking.prototype.paymentMethod = function () {
    var imgurl1,imgurl2,uploader1,uploader2;
    Pictureupload(uploader1,'.zhifu',imgurl1);
    Pictureupload(uploader2,'.weixin',imgurl2);
    Pictureupload(uploader2,'.revise_zhifu',imgurl2);
    Pictureupload(uploader2,'.revise_weixin',imgurl2);


    //页面数据渲染
    ajaxEve('POST', server.user_info, {}, function (result) {
            console.log(result)
            if (result.status == 200) {
                var dov1 = $('.binding_box');
                var dovbooy1 = $('#binding_box');
                jo.reTpl(dovbooy1,result.data,dov1);
                var reName = result.data.bank_info.realname;
                var bankcard_bankcard = result.data.bank_info.bankcard;
                var bankcard_bankcard1 = bankcard_bankcard.substring(bankcard_bankcard.length-4);
                $('.reName').val(reName);
                $('.card_bankcard').html(bankcard_bankcard1);
                $('.card_bankcard').attr('data-bankcard',bankcard_bankcard);
            }
        },
        function (result) {
            layer.open({
                content: result.msg,skin: 'msg',time: 2
            });
            return;
        });

    var _this = this;
    _this.bindingBtn = $('.binding_btn');
    _this.popTotal = $('.pop_total_two');
    _this.closed = $('.modepayment_mian .closed'); //关闭添加支付方式选择
    _this.stateCancel = $('.state_cancel');       //取消添加支付方式选择
    _this.stateSure = $('.state_sure');       //确认添加支付方式选择

    //添加支付方式选择（银行卡，支付宝，微信）
    _this.dropDown = $('.drop_down .imitationSelect');//支付方式选择
    _this.selectUl = $('.selectUl');//支付方式选择对应内容
    _this.selectLi = $('.selectUl li');//支付方式选择对应内容
    _this.choiceState = $('.choice_state>div');//支付方式选择对应内容




    //银行卡上传
    _this.realname = $('.realname');//真实姓名
    _this.branch = $('.branch');   //开户银行
    _this.bankcard = $('.bankcard'); //银行卡号
    _this.tpwd = $('.tpwd');  //交易密码
    // 支付宝上传
    _this.alipay_number = $('.alipay_number'); //支付宝账号
    _this.alipay_pass = $('.alipay_pass');     //支付宝交易密码
    //微信上传
    _this.wx_number = $('.wx_number'); //微信账号
    _this.wx_pass = $('.wx_pass');     //微信交易密码

    // 显示弹窗
    $('.binding_box').on('click','.binding_btn', function(){
        stateInfo();   //执行用户信息接口
        if($('.judge-or').attr('src') == ''){
            $('.up_bg').show();
            $('.up_wenzi').show();
            $('.judge-or').hide();
            $('.judge-wei').hide();
        }else {
            $('.judge-or').show();
            $('.judge-wei').show();
        }

        if(state_click == 1){
            layer.open({
                content: '还未实名验证，请先去实名验证！',skin: 'msg',time: 2
            });
            window.setTimeout(function(){
                window.location.href = "identify.html";
            },1500);
        }else if(state_click == 2){
            layer.open({
                content: '实名认证正在审核当中，请耐心稍等',skin: 'msg',time: 2
            });
        }else if(state_click == 4){
            layer.open({
                content: '您的审核认证被拒绝，请重新认证',skin: 'msg',time: 2
            });
            window.setTimeout(function(){
                window.location.href = "identify.html";
            },1500);
        }else if(state_click == 5){
            layer.open({
                content: '还未设置支付密码，请先去设置交易密码！',skin: 'msg',time: 2
            });
            window.setTimeout(function(){
                window.location.href = "editpasswordpay.html";
            },1500);
            return false;
        }else {
            _this.popTotal.show();
        }
    });

    //选择
    _this.dropDown.on('click', function() {
        _this.selectUl.toggle();
    });
    _this.selectLi.on('click', function() {
        $(this).addClass('actived_li').siblings().removeClass("actived_li");
        $(this).attr("oliName");
        let oliName = $(this).text();
        _this.dropDown.attr("oliName",oliName);
        _this.dropDown.val(oliName);
        _this.selectUl.hide();
        _this.choiceState.hide();
        let clikIndex = $(this).index();
        _this.choiceState.eq(clikIndex).show();
        $('.judge-or').hide();
        $('.judge-wei').hide();
        $('.up_bg').show();
        $('.up_wenzi').show();
        $('.up_img').css('display','block');
    });
    //关闭添加支付方式选择（弹窗）
    _this.closed.on('click', function(){
        _this.popTotal.hide();
    });
    //取消添加支付方式选择（弹窗）
    _this.stateCancel.on('click', function(){
        _this.popTotal.hide();
    });
    //确认添加
    $('.state_sure').on('click', function(){
        var inpVal = _this.dropDown.val();

        if(inpVal == '银行卡'){
            inpVal = 1;
            var realname = _this.realname.val();//真实姓名
            var branch = _this.branch.val();//开户银行
            var bankcard = _this.bankcard.val();//银行卡号
            var tpwd = _this.tpwd.val();//交易密码
            var Addtraffic = {'pay_type':inpVal,'realname':realname,'branch':branch,'bankcard':bankcard,'tpwd':tpwd};
        }else if(inpVal == '支付宝'){
            console.log('图片',imgurl1);
            inpVal = 2;
            var alipay_number = _this.alipay_number.val();  //支付宝账号
            var alipay_pass = _this.alipay_pass.val();      //支付宝交易密码
            var img_zhifu = $('.judge-or').attr('src').split(url)[1].substr(1);
            console.log(img_zhifu);
            var Addtraffic = {'pay_type':inpVal,'alicard':alipay_number,'aliimg':img_zhifu,'tpwd':alipay_pass};
        }else {
            inpVal = 3;
            var wx_number = _this.wx_number.val();  //微信账号
            var wx_pass = _this.wx_pass.val();      //微信交易密码
            var img_weixin = $('.judge-wei').attr('src').split(url)[1].substr(1);
            console.log(img_weixin);
            var Addtraffic = {'pay_type':inpVal,'wxcard':wx_number,'wximg':img_weixin,'tpwd':wx_pass};
        }
        console.log(Addtraffic);
        if(realname == ''){
            layer.open({
                content:'请输入您的真实姓名',skin: 'msg',time: 2
            });
            return;
        }else if(branch == ''){
            layer.open({
                content:'请输入您的开户银行',skin: 'msg',time: 2
            });
            return;
        }else if(bankcard == ''){
            layer.open({
                content:'请输入您的银行卡号',skin: 'msg',time: 2
            });
            return;
        }else if(tpwd == ''){
            layer.open({
                content:'请输入您的交易密码',skin: 'msg',time: 2
            });
            return;
        }else if(alipay_number == ''){
            layer.open({
                content:'请输入您的支付宝账号',skin: 'msg',time: 2
            });
            return;
        }else if(alipay_pass == ''){
            layer.open({
                content:'请输入您的交易密码',skin: 'msg',time: 2
            });
            return;
        }

        console.log('请求数据');
        layer.open({type: 2 ,shadeClose:false});
        ajaxEve('POST', server.paymentAdd, Addtraffic, function (result) {
                layer.closeAll();
                console.log(result)
                if (result.status == 200) {
                    layer.open({
                        content: result.msg,skin: 'msg',time: 2
                    });
                    _this.popTotal.hide();
                    window.location.reload();
                }
            },
            function (result) {
                layer.closeAll();
                _this.popTotal.hide();
                layer.open({
                    content: result.msg,skin: 'msg',time: 2
                });
                return;
            });
    });
    //修改收款方式
    //修改按钮事件

    _this.bindingList = $('.binding_list');   //修改按钮
    _this.pop_total_one = $('.pop_total_one'); //弹窗2
    _this.one_closed = $('.pop_total_one .closed');
    _this.state_cancel = $('.pop_total_one .state_cancel');
    _this.one_closed.on('click', function(){
        _this.pop_total_one.hide();
    });
    _this.state_cancel.on('click', function(){
        _this.pop_total_one.hide();
    });

    $('.binding_box').on('click','.binding_list', function(){
        var thisName = $(this).attr('data-name');//获取显示哪个弹窗
        _this.pop_total_one.show();//弹窗显示
        var imitationSelect = $('.imitationSelect');//赋值
        _this.pop_total_1 = $('.pop_total_one .state_one'); //修改银行卡显示
        _this.pop_total_2 = $('.pop_total_one .state_two'); //修改支付宝显示
        _this.pop_total_3 = $('.pop_total_one .state_three'); //修改微信显示

        if(thisName == 1){
            console.log($(this));
            imitationSelect.val('银行卡');
            var branch_branch = $('.branch_branch').html();
            var bankcard_bankcard = $('.card_bankcard').attr('data-bankcard');
            $('.revise_bankcard').val(bankcard_bankcard);
            $('.revise_branch').val(branch_branch);
            _this.pop_total_1.show();
            _this.pop_total_1.siblings().hide();
        }else if(thisName == 2){

            var zhifu_p = $('.zhifu_p').text(); //修改获取支付宝账号
            var zhifu_img = $('.zhifu_img').attr('src'); //修改获取支付宝图片
            $('.revise_zhifu_img').attr("src",zhifu_img);
            $('.revise_alipay_number').val(zhifu_p);

            imitationSelect.val('支付宝');
            _this.pop_total_2.show();
            _this.pop_total_2.siblings().hide();
        }else {
            var weixin_p = $('.weixin_p').text(); //修改获取支付宝账号
            var weix_img = $('.weix_img').attr('src'); //修改获取支付宝图片
            $('.revise_wx_number').val(weixin_p);//修改获取微信图片
            $('.revise_weixin_img').attr("src",weix_img);

            imitationSelect.val('微信');
            _this.pop_total_3.show();
            _this.pop_total_3.siblings().hide();
        }
        $('.revise_sure').click(function () {
            if(thisName == 1){
                var Name = thisName; //修改的模块（1：银行卡，2：支付宝，3：微信）
                var reName = $('.reName').val(); //修改真实姓名
                var reviseBranch = $('.revise_branch').val();//修改开户银行
                var reviseBankcard = $('.revise_bankcard').val();//修改银行卡号
                var reviseTpwd = $('.revise_tpwd').val();//交易密码
                var reviseTraffic = {'pay_type':Name,'realname':reName,'branch':reviseBranch,'bankcard':reviseBankcard,'tpwd':reviseTpwd,'set_type':1};  //修改银行卡数据
            }else if(thisName == 2){
                var revise_zhifu_img = $('.revise_zhifu_img').attr('src').split(url)[1].substr(1);
                // console.log($('.revise_zhifu_img').attr('src').split(url)[1].substr(1));

                var Name = thisName; //修改的模块（1：银行卡，2：支付宝，3：微信）
                var revise_alipay_number = $('.revise_alipay_number').val();
                var revise_alipay_pass = $('.revise_alipay_pass').val();
                var reviseTraffic = {'pay_type':Name,'alicard':revise_alipay_number,'aliimg':revise_zhifu_img,'tpwd':revise_alipay_pass,'set_type':1};  //修改支付宝数据
            }else {
                var Name = thisName; //修改的模块（1：银行卡，2：支付宝，3：微信）
                var revise_weixin_img = $('.revise_weixin_img').attr('src').split(url)[1].substr(1);
                var revise_wx_number = $('.revise_wx_number').val();
                var revise_wx_pass = $('.revise_wx_pass').val();
                var reviseTraffic = {'pay_type':Name,'wxcard':revise_wx_number,'wximg':revise_weixin_img,'tpwd':revise_wx_pass,'set_type':1};  //修改微信数据
            }


            if(reviseBranch == ''){
                layer.open({
                    content:'请输入您的开户银行',skin: 'msg',time: 2
                });
                return;
            }else if(reviseBankcard == ''){
                layer.open({
                    content:'请输入您的银行卡号',skin: 'msg',time: 2
                });
                return;
            }else if(reviseTpwd == '' || revise_alipay_pass =='' || revise_wx_pass == ''){
                layer.open({
                    content:'请输入您的交易密码',skin: 'msg',time: 2
                });
                return;
            }else if(revise_alipay_number == ''){
                layer.open({
                    content:'请输入您的支付宝账号',skin: 'msg',time: 2
                });
                return;
            }else if(revise_wx_number == ''){
                layer.open({
                    content:'请输入您的微信账号',skin: 'msg',time: 2
                });
                return;
            }
            layer.open({type: 2 ,shadeClose:false});
            ajaxEve('POST', server.paymentAdd, reviseTraffic, function (result) {
                    layer.closeAll();

                    if (result.status == 200) {
                        layer.open({
                            content: result.msg,skin: 'msg',time: 2
                        });
                    }
                    _this.pop_total_one.hide();//弹窗隐藏
                    window.location.reload();
                },
                function (result) {
                    layer.closeAll();
                    _this.pop_total_one.hide();//弹窗隐藏
                    layer.open({
                        content: result.msg,skin: 'msg',time: 2
                    });
                    return;
                });
        })

    });

};


networking.prototype.miner = function (argument) {
	var _this = this;

	ajaxEve('post', server.myproductlist, {}, function (result) {
	    if (result.status == 200) {	
			if(result.data.length == "0"){
	        	Dataacquisition();
	        }else {
	        	switch (result.data[0].status) {
		    		case '3':
		    				Dataacquisition();
		    			break;
		    		default:
		    			jo.reTpl($('#test1'),result,$('#container1'));
		    		break;
		    	};
	        };
	    };
	}, function (result) {
	    return;
	});


	ajaxEve('post', server.user_info, {}, function (result) {
	    if (result.status == 200) {	
			_this.userinfo = result.data;
	    };
	}, function (result) {
	    return;
	});
	function Dataacquisition(){
		ajaxEve('post', server.productindex, {}, function (result) {
		    if (result.status == 200) {
		        jo.reTpl($('#test'),result,$('#container'));
		        seruer(); 
		    };
		}, function (result) {
		    return;
		});
	};
	
	function seruer(){
		$('.but').click(function(){
			if (_this.userinfo.status == "1") {
				layer.open({
	                content: '还未实名验证，请先去实名验证！',skin: 'msg',time: 2
	            });
	            window.setTimeout(function(){
	                window.location.href = "identify.html";
	            },1500);
	            return false;
			};
			if (_this.userinfo.status == "2") {
				 layer.open({
	                content: '实名认证正在审核当中，请耐心稍等',skin: 'msg',time: 2
	            });
				return false;
			};
			if (_this.userinfo.status == "4") {
				layer.open({
	                content: '您的审核认证被拒绝，请重新认证',skin: 'msg',time: 2
	            });
	            window.setTimeout(function(){
	                window.location.href = "identify.html";
	            },1500);
				return false;
			};
			if (_this.userinfo.has_tpwd != "1") {
				layer.open({
				    content: '还未设置支付密码，请先去设置交易密码！',skin: 'msg',time: 2 
				});
				window.setTimeout(function(){
					window.location.href = "editpasswordpay.html";
				},1500);
				return false;
			};
			_this.dataid = $(this).attr('data_id');
			layer.open({
	            title:'交易密码',
	            className: 'popuo-login',
	            content:'<div class="input-password"><input id="paypass" name="mobile" type="password" placeholder="请输入交易密码"></div>',
	            shadeClose:false,   //点击遮罩层是否关闭弹窗
	            btn: ['确定', '取消'],
	            yes: function(index){
                    _this.opwd = document.getElementsByName('mobile')[0].value;
                    console.log(_this.opwd);
                    if (!_this.opwd) {
                        layer.open({
                            content: '请输入支付密码',skin: 'msg',time: 2
                        });
                        return false;
                    };
                    if (!_this.Password(_this.opwd)) {
                        layer.open({
                            content: '密码格式有误！',skin: 'msg',time: 2
                        });
                        return false;
                    };
                    _this.Submitdata = {
                        'account':sessionStorage.account,
                        'tpwd':_this.opwd
                    };
                    var layerOpen =  layer.open({type: 2 ,shadeClose:false});
					let _data = {
						id: _this.dataid,
						tpwd:_this.opwd,
					};

					layer.open({type: 2 ,shadeClose:false});
					
				    ajaxEve('post', server.buyproduct, _data, function (result) {
				    	layer.closeAll();
				    	if(result.status == '200'){
				    		layer.open({
						      	content: result.msg ,time: 2 ,skin: 'msg'
						  	});
						  	window.setTimeout(function(){
								window.location.href = "index.html";
							},1500);
				    	}else {
				    		layer.open({
						      	content: result.msg ,time: 2 ,skin: 'msg'
						  	});
				    	}
					}, function (result) {
						layer.closeAll();
						layer.open({
					      	content: result.msg ,time: 2 ,skin: 'msg'
					  	});
					    return;
					});
	            }
	        });
		});
	};
};
//元素
function networking(){
    this.collagehallList = $('.collagehall_list');                 //进入拼多多（1或2）
    this.popTotal = $('.collage_mian .pop_total');                 //弹窗
    this.cancel = $('.collage_mian .cancel');                 //弹窗取消



};
//拼多多首页
networking.prototype.collageIndex = function (){
    var dataType = '';
    ajaxEve('POST', server.collageNotice, {}, function (result) {
            console.log(result);
            var dov = $('.roll_list');
            var dataInfo = result;
            var dovbooy = $('#roll_list');
            jo.reTpl(dovbooy, dataInfo, dov);
        },
        function (result) {
            layer.open({
                content: result.msg,skin: 'msg',time: 2
            });
            return;
        });

    $('.collagehall_mian').on('click','.collagehall_list', function(){
        dataType = $(this).attr("data-type");
        if(dataType == 1){
            $(location).attr('href', 'collage.html?type='+ dataType);
        }else {
            $(location).attr('href', 'collagetwo.html?type='+ dataType);
        }
    });
};
//拼多多（1,2）数据
networking.prototype.collageData = function (){
    this.pinInp = $('.pop_total .pin_inp');//拼多多输入框
    this.pinAdd = $('.pop_total .pin_add');//拼多多加法
    this.pinReduc = $('.pop_total .pin_reduce');//拼多多减法
    this.pinsure = $('.sure1');//拼多多确认
    this.collageList = $('collage_list');

    this,collage_list = $('.collage_mian .collage_list');

    var _this = this;
    let num = '';
    var inc_type = GetQueryString('type');
    var browser_width = $(document.body).width();
    var div_width = browser_width/5.36;
    ajaxEve('POST', server.collageJudge, {inc_type:inc_type}, function (result) {
            console.log(result)
            var dov = $('.collage_mian');
            var dataInfo = result.data;
            var dovbooy = $('#collage_mian');
            jo.reTpl(dovbooy, dataInfo, dov);
            for(var i = 0; i < result.data.type_list.length; i++){
                id = result.data.type_list[i].id;
                value = result.data.type_list[i].per*100;

                $(".progress").eq(i).circleChart({
                    size:div_width,
                    value:value,
                    text:0,
                    color:"#425eb2",
                    backgroundColor:"#142b56",
                    startAngle: 175,
                    onDraw: function(el, circle) {
                        circle.text(Math.ceil(circle.value) + "%");
                    }
                });
            }
        },
        function (result) {
            layer.open({
                content: result.msg,skin: 'msg',time: 2
            });
            return;
        });
    //选择弹窗
    $('.collage_mian').on('click', '.collage_list',function(){
        // _this.popTotal.show();
        z_money = $(this).attr("data-money");
        z_id = $(this).attr("data-id");
        console.log(z_id)
        // $('.money span').html(z_money);
        // _this.pinsure.attr({ 'data-id':z_id });
        if(inc_type == 1){
            layer.open({
                className: 'popuo-login',
                content:'<p>参与本轮'+ z_money + '币拼多多将扣除参与费' + z_money + 'CLW</p>',
                shadeClose:false,   //点击遮罩层是否关闭弹窗
                btn: ['进入游戏', '取消'],
                yes: function(){
                    layer.open({type: 2 ,shadeClose:false});
                    ajaxEve('POST', server.collagePurchase, {id:z_id,buynum:1}, function (result) {
                            layer.closeAll();
                        console.log(result)
                            if(result.status == 200){
                                layer.open({
                                    content:result.msg,skin: 'msg',time: 2
                                });
                                window.setTimeout(function () {
                                    window.location.reload();
                                },1500)
                            }
                        },
                        function (result) {
                            layer.open({
                                content: result.msg,skin: 'msg',time: 2
                            });
                            return;
                        });
                }
            });
        }else {
            layer.open({
                className: 'popuo-login',
                content:'<div class="calculation">\n' +
                '                <div>\n' +
                '                    <label for="">参与份数</label>\n' +
                '                    <input class="pin_inp" type="number" placeholder="参与份数" value="1">\n' +
                '                </div>\n' +
                '                <span class="pin_reduce">-</span>\n' +
                '                <span class="pin_add">+</span>\n' +
                '            </div>\n' +
                '            <div class="money">参与本轮<span>'+ z_money +'</span>币拼多多确认将扣除<span>'+ z_money +'</span> CLW币</div>',
                shadeClose:false,   //点击遮罩层是否关闭弹窗
                btn: ['进入游戏', '取消'],
                yes: function(){
                    // console.log($('.pin_inp').val())
                    layer.open({type: 2 ,shadeClose:false});
                    dataid = $('.collage_list').attr("data-id");  //id
                    pinInp = $('.pin_inp').val();       //买入份数

                    ajaxEve('POST', server.collagePurchase, {id:z_id,buynum:pinInp}, function (result) {
                            layer.closeAll();
                            console.log(result)
                            if(result.status == 200){
                                window.setTimeout(function () {
                                    window.location.reload();
                                },1000)
                                layer.open({
                                    content:result.msg,skin: 'msg',time: 2
                                });
                            }
                        },
                        function (result) {
                            layer.open({
                                content: result.msg,skin: 'msg',time: 2
                            });
                            return;
                        });
                },
                success: function(){
                    var _this = this;
                    _this.pinInp = $('.calculation .pin_inp');//拼多多输入框
                    _this.pinAdd = $('.calculation .pin_add');//拼多多加法
                    _this.pinReduc = $('.calculation .pin_reduce');//拼多多减法
                    //加法
                    _this.pinAdd.on('click', function(){
                        add_num = parseInt(_this.pinInp.val());
                        datatake = $('.collage_list').attr("data-take");
                        if(add_num >= datatake){
                            layer.open({
                                content:'最多买入'+ datatake +'份',skin: 'msg',time: 2
                            });
                            add_num = 1;
                        }
                        num = _this.pinInp.val(add_num + 1);
                    });
                    //减法
                    _this.pinReduc.on('click', function(){
                        add_num = parseInt(_this.pinInp.val());
                        if(add_num <= 1){
                            layer.open({
                                content:'最少买入1份',skin: 'msg',time: 2
                            });
                            add_num = 1;
                        }
                        num = _this.pinInp.val(add_num - 1);
                    });
                }
            });
        }
    });
    //取消弹窗
    // _this.cancel.on('click', function(){
    //     _this.popTotal.hide();
    // });
    // $('.pop_total .cancel').on('click', function(){
    //    $('.pop_total').hide();
    // });
    // _this.pinInp = $('.calculation .pin_inp');//拼多多输入框
    // _this.pinAdd = $('.calculation .pin_add');//拼多多加法
    // _this.pinReduc = $('.calculation .pin_reduce');//拼多多减法
    //拼多多计算输入框(加)


    // _this.pinAdd.on('click', function(){
    //     console.log(123456)
    //     add_num = parseInt(_this.pinInp.val());
    //     datatake = $('.collage_list').attr("data-take");
    //     if(add_num >= datatake){
    //         layer.open({
    //             content:'最多买入'+ datatake +'份',skin: 'msg',time: 2
    //         });
    //         return;
    //     }
    //     num = _this.pinInp.val(add_num + 1)
    // });
    //拼多多计算输入框(减)
    // _this.pinReduc.on('click', function(){
    //     add_num = parseInt(_this.pinInp.val());
    //     if(add_num <= 1){
    //         layer.open({
    //             content:'最少买入1份',skin: 'msg',time: 2
    //         });
    //         return;
    //     }
    //     num = _this.pinInp.val(add_num - 1);
    // });
    //确认弹窗
    // _this.pinsure.on('click', function(){
    //     dataid = $(this).attr("data-id");  //id
    //     pinInp = _this.pinInp.val();       //买入份数
    //     var type = GetQueryString('type');
    //     console.log(type);
    //     if(type == 1){
    //         pinInp = 1;
    //     }
    //     layer.open({type: 2 ,shadeClose:false});
    //     ajaxEve('POST', server.collagePurchase, {id:dataid,buynum:pinInp}, function (result) {
    //             layer.closeAll();
    //             if(result.status == 200){
    //                 layer.open({
    //                     content:result.msg,skin: 'msg',time: 2
    //                 });
    //                 _this.popTotal.hide();
    //                 window.location.reload();
    //             }
    //         },
    //         function (result) {
    //             layer.closeAll();
    //             _this.popTotal.hide();
    //             layer.open({
    //                 content: result.msg,skin: 'msg',time: 2
    //             });
    //             return;
    //         });
    // });
};
//拼多多历史记录（1,2）
networking.prototype.historyData = function (){

    var type = GetQueryString('type');
    console.log(type);
    // ajaxEve('POST', server.pinhistory, {type:type}, function (result) {
    //     console.log(result);
    //         if(result.status == 200){
    //             var dov = $('.pdrecords_list');
    //             var dataInfo = result.data;
    //             var dovbooy = $('#pdrecords_list');
    //             var type = type;
    //             jo.reTpl(dovbooy, dataInfo, dov,type);
    //         }
    //     },
    //     function (result) {
    //         layer.open({
    //             content: result.msg,skin: 'msg',time: 2
    //         });
    //         return;
    //     });

    var page=1,size=1,datas=null,status=true;
    var dovList = $('.pdrecords_list');
    var dovbooyList = $('#pdrecords_list');
    //
    $.ajax({
        url:server.pinhistory,
        type:'post',
        data:{page:page,type:type},
        beforeSend: function(request) {
            request.setRequestHeader("account",accontdata);
            request.setRequestHeader("token",tokendata);
        },
        success:function(data){
            console.log(data)
            if(data.status == 200){
                datas=data.data;
                jo.reTpl(dovbooyList,datas,dovList);
                $('.pull-down').hide();
            }
        },
        error:function(data){

        }
    });
    window.onscroll=function(){
        var allHeight=document.body.offsetHeight||document.documentElement.offsetHeight;
        var scrollHeight=document.documentElement.scrollTop || document.body.scrollTop;
        var curHeight=document.documentElement.clientHeight;
        var cha=allHeight-scrollHeight-curHeight;
        if(cha<60){
            if(status){
                status=false;
                page+=1;
                $.ajax({
                    url:server.pinhistory,
                    type:'post',
                    data:{page:page,type:type},
                    beforeSend: function(request) {
                        request.setRequestHeader("account",accontdata);
                        request.setRequestHeader("token",tokendata);
                    },
                    success:function(data){
                        if(data.status == 200){
                            if(data.data.history_list.length>0){
                                for(var i=0;i<data.data.history_list.length;i++){
                                    datas.history_list.push(data.data.history_list[i]);
                                }
                                jo.reTpl(dovbooyList,datas,dovList);
                                status=true;
                            }else{
                                status = false;
                                $('.pull-down').html('暂无更多记录');
                            }
                        }
                    },
                    error:function(data){

                    }
                });
            }
        }
    }


};
//元素
function networking(){
    this.gameList = $('.game_list');//发红包（进入游戏）
    this.popTotal = $('.pop_total');//弹窗
    this.cancel = $(' .cancel');//取消弹窗
    this.goGame = $('.go_game');//进入游戏

    this.openRed = $('.open');  //开起红包

    this.envelopes_one = $('.envelopes_one');  //红包状态一
    this.envelopes_two = $('.envelopes_two');  //红包状态二
    this.envelopes_three = $('.envelopes_three');//红包状态三

    this.freeOne = $('.free_1 .free_one');   //剩余两人才能开奖

    this.deduct_p = $('.deduct_p');         //扣除最低保证金
};

networking.prototype.redenvelopes = function (argument) {
    loginState();
    let gameId = ''; //获取3个游戏的自定义ID
    let redId = '';   //红包ID
    var _this = this;
    _this.gameList.on('click', function(){
        gameId = $(this).attr("data-id");
        stateInfo();   //执行用户信息接口
        loginState();
        if(!loginState()){
            return false
        }
        if(state_click == 1){
            layer.open({
                content: '还未实名验证，请先去实名验证！',skin: 'msg',time: 2
            });
            window.setTimeout(function(){
                window.location.href = "identify.html";
            },1500);
        }else if(state_click == 2){
            layer.open({
                content: '实名认证正在审核当中，请耐心稍等',skin: 'msg',time: 2
            });
        }else if(state_click == 4){
            layer.open({
                content: '您的审核认证被拒绝，请重新认证',skin: 'msg',time: 2
            });
            window.setTimeout(function(){
                window.location.href = "identify.html";
            },1500);
        }else if(state_click == 5){
                layer.open({
                    content: '还未设置支付密码，请先去设置交易密码！',skin: 'msg',time: 2
                });
                window.setTimeout(function(){
                    window.location.href = "editpasswordpay.html";
                },1500);
                return false;
        }else {
            if(gameId == 1){
                ajaxEve('POST', server.hand_red_entrance, {}, function (result) {
                    console.log(result)
                    if (result.status == 200) {
                        var red_money = result.data.info.join_money;
                        _this.old_id = result.data.old_id;
                        redId = result.data.info.red_id;
                        if(result.data.code == "1"){
                            window.location.href = "handredenvelopes.html?red_id="+ redId +'&type_code='+ 3 +'&old_id=' + _this.old_id;
                            return false;
                        }
                        layer.open({
                            className: 'popuo-login',
                            content:'<div class="hongbao">'+escapeHtml(result.data.rule)+'</div>',
                            shadeClose:false,   //点击遮罩层是否关闭弹窗
                            btn: ['进入游戏', '取消'],
                            yes: function(){
                                layer.open({type: 2 ,shadeClose:false});

                                window.location.href = "handredenvelopes.html?red_id="+redId +'&type_code='+ 1 +'&old_id=' + _this.old_id;
                                // ajaxEve('POST', server.join_game, {'id':redId}, function (result) {
                                //     layer.closeAll();
                                //     if (result.status == 200) {
                                //         window.location.href = "handredenvelopes.html?red_id="+redId +'&type_code='+ 1 +'&old_id=' + _this.old_id;
                                //     }
                                // },
                                // function (result) {
                                //     layer.open({
                                //         content: result.msg,skin: 'msg',time: 2
                                //     });
                                //     return;
                                // });
                            }
                        });
                    }
                    // else if(result.status == 200 && result.data.code == 1){
                    //     redId = result.data.info.red_id;
                    //     _this.old_id = result.data.old_id;
                    //     _this.redId = {
                    //         'id':redId
                    //     };
                    //     ajaxEve('POST', server.open_bag, _this.redId, function (result) {
                    //         if(result.status == 200 && result.data.code == 0){
                    //             window.location.href = "handredenvelopes.html?red_id="+redId +'&type_code='+ 3 +'&old_id=' + _this.old_id;
                    //         }else if(result.status == 200 && result.data.code == 1) {
                    //             window.location.href = "handredenvelopes.html?red_id="+redId +'&type_code='+ 2 +'&old_id=' + _this.old_id;
                    //         }
                    //     },
                    //     function (result) {
                    //         _this.popTotal.hide();
                    //         layer.open({
                    //             content: result.msg,skin: 'msg',time: 2
                    //         });
                    //         return;
                    //     });
                    // }
                },
                function (result) {
                    layer.open({
                        content: result.msg,skin: 'msg',time: 2
                    });
                    return;
                });
            }else if(gameId == 2){
                // $(location).attr('href', 'collagehall.html');
                window.location.href = "collagehall.html";
            }else {
                // $(location).attr('href', 'smashgoldeggs.html');
                window.location.href = "smashgoldeggs.html";
            }
        }
    });
};

//红包状态
networking.prototype.redstate = function (argument) {
    var _this = this;
    var red_id = GetQueryString('red_id');
    var old_id = GetQueryString('old_id');
    var type_code = GetQueryString('type_code');
    _this.redId = {
        'id':red_id
    };
    if(type_code == '3'){
        getshuju(red_id,'3');
    }else {
        var dov = $('.envelopes');
        var dataInfo = {};
        var dovbooy = $('#envelopes');
        dataInfo.type_code = "1";
        jo.reTpl(dovbooy, dataInfo, dov); 
    }
    seruer();
    function getshuju(idtype,type){
        ajaxEve('POST', server.open_bag, {'id':idtype}, function (result) {
            if(result.status == 200 && result.data.code == 0){
                var dov = $('.envelopes');
                var dataInfo = result.data;
                var dovbooy = $('#envelopes');
                dataInfo.type_code = type;
                jo.reTpl(dovbooy, dataInfo, dov);       
            }else {
                var dov = $('.envelopes');
                var dataInfo = result.data;
                var dovbooy = $('#envelopes');
                dataInfo.type_code = type;
                jo.reTpl(dovbooy, dataInfo, dov);
            };
            seruer();
        });
    };
    //开红包
    $('.open').click(function () {
        var red_id = GetQueryString('red_id');
        _this.redId = {
            'id':red_id
        };
        layer.open({type: 2 ,shadeClose:false});
        ajaxEve('POST', server.join_game, _this.redId, function (result) {
                console.log(result);
                layer.closeAll();
                if (result.status == 200) {
                    ajaxEve('POST', server.open_bag, _this.redId, function (result) {
                        console.log(result)
                        if(result.data.code == 0){
                            // window.location.href = "handredenvelopes.html?red_id="+red_id +'&type_code='+ 3 + '&old_id=' + old_id;
                            var dov = $('.envelopes');
                            var dataInfo = result.data;
                            var dovbooy = $('#envelopes');
                            dataInfo.type_code = "3";
                            jo.reTpl(dovbooy, dataInfo, dov);
                        }else if(result.data.code == 1){
                            // window.location.href = "handredenvelopes.html?red_id="+red_id +'&type_code='+ 2 + '&old_id=' + old_id;
                            var dov = $('.envelopes');
                            var dataInfo = result.data;
                            var dovbooy = $('#envelopes');
                            dataInfo.type_code = "2";
                            jo.reTpl(dovbooy, dataInfo, dov);
                        }
                    },function (result) {
                        _this.popTotal.hide();
                        layer.open({
                            content: result.msg,skin: 'msg',time: 2
                        });
                        return;
                    });
                }
            },
            function (result) {
                layer.open({
                    content: result.msg,skin: 'msg',time: 2
                });
                return;
            });
        // ajaxEve('POST', server.open_bag, _this.redId, function (result) {
        //     if(result.data.code == 0){
        //         // window.location.href = "handredenvelopes.html?red_id="+red_id +'&type_code='+ 3 + '&old_id=' + old_id;
        //         var dov = $('.envelopes');
        //         var dataInfo = result.data;
        //         var dovbooy = $('#envelopes');
        //         dataInfo.type_code = "3"
        //         jo.reTpl(dovbooy, dataInfo, dov);
        //     }else if(result.data.code == 1){
        //         // window.location.href = "handredenvelopes.html?red_id="+red_id +'&type_code='+ 2 + '&old_id=' + old_id;
        //         var dov = $('.envelopes');
        //         var dataInfo = result.data;
        //         var dovbooy = $('#envelopes');
        //         dataInfo.type_code = "2"
        //         jo.reTpl(dovbooy, dataInfo, dov);
        //     }
        // },function (result) {
        //     _this.popTotal.hide();
        //     layer.open({
        //         content: result.msg,skin: 'msg',time: 2
        //     });
        //     return;
        // });
    });
    function seruer(){
        if(old_id == '0' || !old_id){
            $(".open_word_0").hide();
        };
        $('.open_word_0').click(function(){
            getshuju(GetQueryString('old_id'),'2');
        });


    };
};




//红包历史记录
networking.prototype.redhistory = function (argument){
    // ajaxEve('POST', server.redhistory, {}, function (result) {
    //         console.log(result)
    //         if(result.status == 200){
    //             var dov = $('.redhistory_box');
    //             var dataInfo = result.data;
    //             var dovbooy = $('#redhistory');
    //             jo.reTpl(dovbooy, dataInfo, dov);
    //         }
    //     },
    //     function (result) {
    //         layer.open({
    //             content: result.msg,skin: 'msg',time: 2
    //         });
    //         return;
    //     });
    var page=1,size=1,datas=null,status=true;
    var dovList = $('.redhistory_box');
    var dovbooyList = $('#redhistory');
    //
    $.ajax({
        url:server.redhistory,
        type:'post',
        data:{page:page},
        beforeSend: function(request) {
            request.setRequestHeader("account",accontdata);
            request.setRequestHeader("token",tokendata);
        },
        success:function(data){
            console.log(data)
            if(data.status == 200){
                datas=data.data;
                jo.reTpl(dovbooyList,datas,dovList);
                $('.pull-down').hide();
            }
        },
        error:function(data){

        }
    });
    window.onscroll=function(){
        var allHeight=document.body.offsetHeight||document.documentElement.offsetHeight;
        var scrollHeight=document.documentElement.scrollTop || document.body.scrollTop;
        var curHeight=document.documentElement.clientHeight;
        var cha=allHeight-scrollHeight-curHeight;
        if(cha<60){
            if(status){
                status=false;
                page+=1;
                $.ajax({
                    url:server.redhistory,
                    type:'post',
                    data:{page:page},
                    beforeSend: function(request) {
                        request.setRequestHeader("account",accontdata);
                        request.setRequestHeader("token",tokendata);
                    },
                    success:function(data){
                        if(data.status == 200){
                            if(data.data.history_list.length>0){
                                for(var i=0;i<data.data.history_list.length;i++){
                                    datas.history_list.push(data.data.history_list[i]);
                                }
                                jo.reTpl(dovbooyList,datas,dovList);
                                status=true;
                            }else{
                                status = false;
                                $('.pull-down').html('暂无更多记录');
                            }
                        }
                    },
                    error:function(data){

                    }
                });
            }
        }
    }
};




//判断认证状态
var state_click = '';
function stateInfo() {
    $.ajax({
        url:server.user_info,
        type:'POST',
        async:false,
        beforeSend: function(request) {
            request.setRequestHeader("account",accontdata);
            request.setRequestHeader("token",tokendata);
        },
        success:function(result){
            if (result.status == 200) {
                var userinfo = result.data; //个人资料数据
                if (userinfo.status == '1') {
                    state_click = 1;
                }else if(userinfo.status == '2'){
                    state_click = 2;
                }else if(userinfo.status == '4'){
                    state_click = 4;
                }else if(userinfo.has_tpwd != '1'){
                    state_click = 5;
                }
            }
        }
    })
}
//商城首页
networking.prototype.shopmail = function(){
    loginState();
    var _this = this;
    //商城轮播
    var dov = $('.swiper-container');
    var dovbooy = $('#swiper-wrapper');
    $.ajax({
        url:server.shop_lunbo,
        type:'post',
        success:function(data){
            if(data.status == 200){
                jo.reTpl(dovbooy,data,dov);
                _this.swiperInit();
            }
        },
        error:function(data){

        }
    });
    // 商城列表
    var page=1,size=4,datas=null,status=true;
    var dovList = $('.shop_list_wrap');
    var dovbooyList = $('#shop_list');
    $.ajax({
        url:server.shop_maillist,
        type:'post',
        data:{page:page,size:size},
        success:function(data){
            if(data.status == 200){
                datas=data;
                if(datas.data.length == 0){
                    $('.pull-down1').hide();
                    $('.pull-down2').show();
                }
                if(datas.data.length == size){
                    $('.pull-down1').show();
                    $('.pull-down2').hide();
                }
                jo.reTpl(dovbooyList,datas,dovList);
            }
        },
        error:function(data){

        }
    });
    //滚动事件触发
    window.onscroll = function() {
        if(_this.getScrollTop() + _this.getClientHeight() == _this.getScrollHeight()) {
            if(status){
                status=false;
                page+=1;
                $.ajax({
                    url:server.shop_maillist,
                    type:'post',
                    data:{page:page,size:size},
                    success:function(data){
                        if(data.status == 200){
                            if(data.data.length>0){
                                for(var i=0;i<data.data.length;i++){
                                    datas.data.push(data.data[i]);
                                }
                                setTimeout(function(){
                                    jo.reTpl(dovbooyList,datas,dovList);
                                },1000);
                                status=true;
                            }else{
                                status=false;
                                $('.pull-down1').hide();
                                $('.pull-down2').show();
                            }
                        }
                    },
                    error:function(data){

                    }
                });
            }
        }
    }
};


//商城详情页
networking.prototype.goodsdetails = function(){
    var _this = this;
    //详情页轮播
    _this.hrefId = GetQueryString("id");
    if(_this.hrefId){
        window.sessionStorage.goodsbuyid = GetQueryString("id");
    }else {
        _this.hrefId = goodsbuyid;
    };
    
    var dov = $('.swiper-container');
    var dovbooy = $('#swiper-wrapper');
    var dovbooy1 = $('#descrip');
    var dov1 = $('.descrip');
    var shouxufei;
    $.ajax({
        url:server.shop_maildetail,
        type:'post',
        data:{'id':_this.hrefId},
        success:function(data){
            if(data.status == 200){
                jo.reTpl(dovbooy,data.data,dov);
                _this.swiperInit();
                jo.reTpl(dovbooy1,data.data,dov1);
                $('.total').html(data.data.price);
                $('#shouxufei').html(data.data.sx);
                shouxufei = data.data.sx;
            }
        },
        error:function(data){

        }
    });
    //增加购买数量,输入购买数量
    _this.buyNum = $('.buy-num');
    _this.total = $(".total");
    _this.shouxufei = $('#shouxufei');
    $('.add1').on('click', function(){
        var num = Number(_this.buyNum.html());
        var singPrices = Number($('.sing-price').html());
        num = _this.Addition(num,1);
        _this.buyNum.html(num);
        $('.buy-num-input').val(num);
        var allTotal = _this.Multiplication(num,singPrices);
        var allSxf = _this.Multiplication(num,shouxufei);
        _this.total.html(allTotal);
        _this.shouxufei.html(allSxf);
    });
    $('.reduce1').on('click', function(){
        var num = Number(_this.buyNum.html());
        var singPrices = Number($('.sing-price').html());
        num = _this.Subtraction(num, 1);
        if(num <= 1){
            num = 1;
        }
        _this.buyNum.html(num);
        $('.buy-num-input').val(num);
        var allTotal = _this.Multiplication(num,singPrices);
        var allSxf = _this.Multiplication(num,shouxufei);
        _this.total.html(allTotal);
        _this.shouxufei.html(allSxf);
    });
    //出价改变
    $('.buy-num-input').on('input', function(){
        var num = Number($(this).val());
        var singPrices = Number($('.sing-price').html());
        var allTotal = _this.Multiplication(num,singPrices);
        var allSxf = _this.Multiplication(num,shouxufei);
        _this.total.html(allTotal);
        _this.shouxufei.html(allSxf);
    });
    //立即购买
    $('.btn-btn').on('click', function(){
        if( _this.userinfo.status == 1 || _this.userinfo.status == 4){
            // $('.tan-shiming').show();
            layer.open({
                className: 'popuo-login',
                content:'<p class="tips-content">您还未实名认证，是否前往实名认证</p>',
                shadeClose:false,   //点击遮罩层是否关闭弹窗
                btn: ['前往', '取消'],
                yes: function(){
                    window.location.href = './identify.html';
                }
            });
            return false;
        }
        if( _this.userinfo.status == 2){
            // $('.tan-shiming-shehe').show();
            layer.open({
                className: 'popuo-login',
                content:'<p class="tips-content">您的实名认证正在审核中</p>',
                shadeClose:false,   //点击遮罩层是否关闭弹窗
                btn: ['前往查看', '取消'],
                yes: function(){
                    window.location.href = './persondata.html';
                }
            });
            return false;
        }
        if( _this.userinfo.has_tpwd == 0){
            // $('.tan-password').show();
            layer.open({
                className: 'popuo-login',
                content:'<p>您还未设置交易密码，是否前往设置</p>',
                shadeClose:false,   //点击遮罩层是否关闭弹窗
                btn: ['前往', '取消'],
                yes: function(){
                    window.location.href = './editpasswordpay.html';
                }
            });
            return false;
        }
        // if(!_this.userinfo.ali_info.alicard && !_this.userinfo.bank_info.realname && !_this.userinfo.wx_info.wxcard){
        //     // $(".tan-payway").show();
        //     layer.open({
        //         className: 'popuo-login',
        //         content:'<p class="tips-content">您还未设置支付方式，是否前往设置</p>',
        //         shadeClose:false,   //点击遮罩层是否关闭弹窗
        //         btn: ['前往', '取消'],
        //         yes: function(){
        //             window.location.href = './modepayment.html';
        //         }
        //     });
        //     return false;
        // }
        _this.liuYan = $('.buy-liuyan').val();
        _this.Submitdata = {
            'goods_id':_this.hrefId,
            'num':_this.buyNum.html(),
            'liuyan':_this.liuYan
        };
        var layerOpen =  layer.open({type: 2 ,shadeClose:false});
        ajaxEve('post', server.shop_mailbuy, _this.Submitdata, function (result) {
            layer.close(layerOpen);
            if (result.status == 200) {
                layer.open({
                    content:'购买成功',skin: 'msg',time: 2
                });
                window.sessionStorage.shopmailbuy = result.data;
                window.sessionStorage.shopmailbuytype = '1';
                setTimeout(function(){
                    location.href = './goodsbuy.html?id='+result.data;
                },1500);
                return;
            } else if (result.status == 0) {
                layer.open({
                    content: result.msg,skin: 'msg',time: 2
                });
            }
        }, function (result) {
            layer.open({
                content: result.msg,skin: 'msg',time: 2
            });
            setTimeout(function(){
                layer.close(layerOpen);
            },1500);
            return;
        });
    });
    //弹框隐藏
    $('body').on('click','.quxiao', function(){
        $('.tan').hide();
    });
};

//确认订单
networking.prototype.goodsbuy = function(){
    var _this = this;
    // //监听返回页面
    // $(window).on("popstate", function(e) {
    //     console.log('11')
    //     alert("我监听到了浏览器的返回按钮事件啦");//根据自己的需求实现自己的功能
    // });
    // _this.hrefId = shopmailbuy;
    // if(!_this.hrefId){
    //     history.back(-1);
    // }
    _this.hrefId = GetQueryString("id");
    if(_this.hrefId){
        window.sessionStorage.shopmailbuy = GetQueryString("id");
    }else {
        _this.hrefId = shopmailbuy;
    };
    $(".Return  a").click(function(){
        if(shopmailbuytype == "1"){
            
        }else {
            window.location.href = "orderdetails.html?id=" + _this.hrefId;
        };
        switch (shopmailbuytype) {
            case '1':
                window.location.href = "goodsdetails.html?id=" + goodsbuyid;
                break;
            case '2':
                window.location.href = "orderdetails.html?id=" + _this.hrefId;
                break;
            case '3':
                window.location.href = "myorder.html";
                break;
            default:
                // statements_def
                break;
        }
    })
    //获取地址
    var sendData = {
        'page':1,
        'size':''
    };
    var dovadd = $(".goodsbuy-address");
    var dovbooyadd = $('#goodsbuy-address');
    var mineaddress;
    ajaxEve('post', server.mine_address, sendData, function (result) {
        if (result.status == 200) {
            jo.reTpl(dovbooyadd,result,dovadd);
            mineaddress = result.data;
            if(result.data.length > 0){
                _this.addressId = result.data[0].id;
            }else{
                _this.addressId = '';
            };
            $('.address-transfer-hide').click(function(){
                window.sessionStorage.addresstype = "1";
                window.location.href = "address.html";
            });
        }
    }, function (result) {
    });
    //获取订单详情
    var dov = $(".goodsbuy-info");
    var dovbooy = $('#goodsbuy-info');
    _this.Submitdata = {
        'order_id':_this.hrefId,
    };
    ajaxEve('post', server.shop_mailconfirmbuy, _this.Submitdata, function (result) {
        if (result.status == 200) {
            jo.reTpl(dovbooy,result,dov);
            return;
        }
    }, function (result) {
    });

    //弹框隐藏
    $('.quxiao').click(function(){
        $('.tan').hide();
    })
    //立即支付
    $('.tan-setpass .player-sell').on('click', function(){
        _this.opwd = $('#paypass').val();
        if (!_this.opwd) {
            layer.open({
                content: '请输入支付密码',skin: 'msg',time: 2
            });
            return false;
        };
        if (!_this.Password(_this.opwd)) {
            layer.open({
                content: '密码格式有误！',skin: 'msg',time: 2
            });
            return false;
        };
        _this.Submitdata = {
            'account':sessionStorage.account,
            'tpwd':_this.opwd
        };
        var layerOpen =  layer.open({type: 2 ,shadeClose:false});
        ajaxEve('post', server.shop_paypassword, _this.Submitdata, function (result) {
            layer.close(layerOpen);
            if (result.status == 200) {
                //支付接口
                _this.liuYan = $('.buy-liuyan').html();
                _this.Submitdata = {
                    'order_id':_this.hrefId,
                    'jy_password':'',
                    'liuyan':_this.liuYan,
                    'address_id':_this.addressId,
                };

                var layerOpen =  layer.open({type: 2 ,shadeClose:false});
                ajaxEve('post', server.shop_mailconnowbuy, _this.Submitdata, function (result) {
                    layer.close(layerOpen);
                    if (result.status == 200) {
                        layer.open({
                            content:'支付成功',skin: 'msg',time: 2
                        });
                        window.location.replace('./myorder.html');
                        // location.href = './myorder.html';
                        return;
                    }
                }, function (result) {
                    layer.open({
                        content: result.msg,skin: 'msg',time: 2
                    });
                    setTimeout(function(){
                        layer.close(layerOpen);
                    },1500);
                    return;
                });

                return;
            }
        }, function (result) {
            layer.open({
                content: result.msg,skin: 'msg',time: 2
            });
            setTimeout(function(){
                layer.close(layerOpen);
            },1500);
            return;
        });

    });
    $('.pay-now').on('click', function(){
        if(!_this.addressId){
            layer.open({
                content: "还没有收货地址，请添加收货地址",skin: 'msg' , time: 2
            });
            window.setTimeout(function(){
                window.location.href = "address.html";
            },2000);
            return false;
        };
        if( _this.userinfo.status == 1 || _this.userinfo.status == 4){
            // $('.tan-shiming').show();
            layer.open({
                className: 'popuo-login',
                content:'<p class="tips-content">您还未实名认证，是否前往实名认证</p>',
                shadeClose:false,   //点击遮罩层是否关闭弹窗
                btn: ['前往', '取消'],
                yes: function(){
                    window.location.href = './identify.html';
                }
            });
            return false;
        }
        if( _this.userinfo.status == 2){
            // $('.tan-shiming-shehe').show();
            layer.open({
                className: 'popuo-login',
                content:'<p class="tips-content">您的实名认证正在审核中</p>',
                shadeClose:false,   //点击遮罩层是否关闭弹窗
                btn: ['前往查看', '取消'],
                yes: function(){
                    window.location.href = './persondata.html';
                }
            });
            return false;
        }
        if( _this.userinfo.has_tpwd == 0){
            layer.open({
                className: 'popuo-login',
                content:'<p>您还未设置交易密码，是否前往设置</p>',
                shadeClose:false,   //点击遮罩层是否关闭弹窗
                btn: ['前往', '取消'],
                yes: function(){
                    window.location.href = './editpasswordpay.html';
                }
            });
            return false;
        }
        if(!_this.userinfo.ali_info.alicard && !_this.userinfo.bank_info.realname && !_this.userinfo.wx_info.wxcard){
            // $(".tan-payway").show();
            layer.open({
                className: 'popuo-login',
                content:'<p class="tips-content">您还未设置支付方式，是否前往设置</p>',
                shadeClose:false,   //点击遮罩层是否关闭弹窗
                btn: ['前往', '取消'],
                yes: function(){
                    window.location.href = './modepayment.html';
                }
            });
            return false;
        };
        // $('.tan-setpass').show();
        layer.open({
            title:'交易密码',
            className: 'popuo-login',
            content:'<div class="input-password"><input id="paypass" type="password" placeholder="请输入交易密码"></div>',
            shadeClose:false,   //点击遮罩层是否关闭弹窗
            btn: ['确定', '取消'],
            yes: function(index){
                _this.opwd = $('#paypass').val();
                console.log(_this.opwd);
                if (!_this.opwd) {
                    layer.open({
                        content: '请输入支付密码',skin: 'msg',time: 2
                    });
                    return false;
                };
                if (!_this.Password(_this.opwd)) {
                    layer.open({
                        content: '密码格式有误！',skin: 'msg',time: 2
                    });
                    return false;
                };
                _this.Submitdata = {
                    'account':sessionStorage.account,
                    'tpwd':_this.opwd
                };
                var layerOpen =  layer.open({type: 2 ,shadeClose:false});
                ajaxEve('post', server.shop_paypassword, _this.Submitdata, function (result) {
                    layer.close(layerOpen);
                    if (result.status == 200) {
                        //支付接口
                        _this.liuYan = $('.buy-liuyan').html();
                        _this.Submitdata = {
                            'order_id':_this.hrefId,
                            'jy_password':'',
                            'liuyan':_this.liuYan,
                            'address_id':_this.addressId,
                        };

                        var layerOpen =  layer.open({type: 2 ,shadeClose:false});
                        ajaxEve('post', server.shop_mailconnowbuy, _this.Submitdata, function (result) {
                            layer.close(layerOpen);
                            if (result.status == 200) {
                                layer.open({
                                    content:'支付成功',skin: 'msg',time: 2
                                });
                                window.location.replace('./myorder.html');
                                // location.href = './myorder.html';
                                return;
                            }
                        }, function (result) {
                            layer.open({
                                content: result.msg,skin: 'msg',time: 2
                            });
                            setTimeout(function(){
                                layer.close(layerOpen);
                            },1500);
                            return;
                        });

                        return;
                    }
                }, function (result) {
                    layer.open({
                        content: result.msg,skin: 'msg',time: 2
                    });
                    setTimeout(function(){
                        layer.close(layerOpen);
                    },1500);
                    return;
                });
            }
        });

    });
};


//订单列表
networking.prototype.myorder = function(){
    var _this = this;
    var dov = $(".myorder-list");
    var dovbooy = $('#myorder-list');
    _this.orderStatus = '';
    getOrderList();
    $('.myorder-tab li').on('click', function(){
        $('.myorder-tab li').removeClass('active');
        $(this).addClass('active');
        _this.orderStatus = $(this).attr('data-status');
        getOrderList();
    });
    //隐藏弹框
    $('.quxiao').on('click', function(){
        $('.tan').hide();
    });
    //获取订单列表函数
    function getOrderList(){
        _this.Submitdata = {
            'order_status':_this.orderStatus,
        };
        ajaxEve('post', server.myorder_list,  _this.Submitdata, function (result) {
            if (result.status == 200) {
                jo.reTpl(dovbooy,result,dov);
                //取消订单
                $('.confirm-close-quxiao').on('click', function(){
                    $('.tan-close').show();
                    _this.orderId = $(this).attr('data-id');
                });
                $('.cancel-bill').on('click', function(){
                    $('.tan').hide();
                    _this.Submitdata = {
                        'order_id':_this.orderId,
                        'op':'cancel'
                    };
                    var myLyaer = layer.open({type: 2 ,shadeClose:false});
                    ajaxEve('post', server.myorder_operate,  _this.Submitdata, function (result) {
                        layer.close(myLyaer);
                        if (result.status == 200) {
                            layer.open({
                                content: result.msg,skin: 'msg',time: 2
                            });
                            setTimeout(function(){
                                location.reload();
                            },1500);
                            return;
                        }
                    }, function (result) {
                        setTimeout(function(){
                            layer.close(myLyaer);
                        },1500);
                    });
                });
                //确认收货
                $('.confirm-get').on('click', function(){
                    _this.orderId = $(this).attr('data-id');
                    _this.Submitdata = {
                        'order_id':_this.orderId,
                        'op':'finish'
                    };
                    var myLyaer = layer.open({type: 2 ,shadeClose:false});
                    ajaxEve('post', server.myorder_operate,  _this.Submitdata, function (result) {
                        layer.close(myLyaer);
                        if (result.status == 200) {
                            layer.open({
                                content: result.msg,skin: 'msg',time: 2
                            });
                            setTimeout(function(){
                                location.reload();
                            },1500);
                            return;
                        }
                    }, function (result) {
                        setTimeout(function(){
                            layer.close(myLyaer);
                        },1500);
                    });
                });
                //删除订单
                $('.confirm-delete').on('click', function(){
                    $('.tan-delete').show();
                    _this.orderId = $(this).attr('data-id');
                });
                $('.delete-bill').on('click', function(){
                    $('.tan').hide();
                    _this.Submitdata = {
                        'order_id':_this.orderId,
                        'op':'delete'
                    };
                    var myLyaer = layer.open({type: 2 ,shadeClose:false});
                    ajaxEve('post', server.myorder_operate,  _this.Submitdata, function (result) {
                        layer.close(myLyaer);
                        if (result.status == 200) {
                            layer.open({
                                content: result.msg,skin: 'msg',time: 2
                            });
                            setTimeout(function(){
                                location.reload();
                            },1500);
                            return;
                        }
                    }, function (result) {
                        setTimeout(function(){
                            layer.close(myLyaer);
                        },1500);
                    });
                });
                $('.Topay').click(function(){
                    
                    window.location.href = './goodsbuy.html?id='+$(this).attr('data_href');
                    window.sessionStorage.shopmailbuytype = '3';
                });
                return;
            }
        }, function (result) {
        });
    }

};

//定单详情
networking.prototype.orderdetails = function(){
    var _this = this;
    //取消弹框
    $('.quxiao').on('click', function(){
       $(".tan").hide();
    });
    _this.hrefId = GetQueryString("id");

    //获取订单详情
    var dov = $(".orderdetails-content");
    var dovbooy = $('#orderdetails');
    _this.Submitdata = {
        'order_id':_this.hrefId,
    };
    ajaxEve('post', server.myorder_details, _this.Submitdata, function (result) {
        if (result.status == 200) {
            jo.reTpl(dovbooy,result,dov);
            //取消订单
            $('.confirm-close-quxiao').on('click', function(){
                _this.orderId = $(this).attr('data-id');
                $(".tan-close").show();
            });
            $(".cancel-bill").on('click', function(){
                $(".tan").hide();
                _this.Submitdata = {
                    'order_id':_this.orderId,
                    'op':'cancel'
                };
                var myLyaer = layer.open({type: 2 ,shadeClose:false});
                ajaxEve('post', server.myorder_operate,  _this.Submitdata, function (result) {
                    layer.close(myLyaer);
                    if (result.status == 200) {
                        layer.open({
                            content: result.msg,skin: 'msg',time: 2
                        });
                        setTimeout(function(){
                            location.reload();
                        },1500);
                        return;
                    }
                }, function (result) {
                    setTimeout(function(){
                        layer.close(myLyaer);
                    },1500);
                });
            });
            //确认收货
            $('.confirm-get').on('click', function(){
                _this.orderId = $(this).attr('data-id');
                _this.Submitdata = {
                    'order_id':_this.orderId,
                    'op':'finish'
                };
                var myLyaer = layer.open({type: 2 ,shadeClose:false});
                ajaxEve('post', server.myorder_operate,  _this.Submitdata, function (result) {
                    layer.close(myLyaer);
                    if (result.status == 200) {
                        layer.open({
                            content: result.msg,skin: 'msg',time: 2
                        });
                        setTimeout(function(){
                            location.reload();
                        },1500);
                        return;
                    }
                }, function (result) {
                    setTimeout(function(){
                        layer.close(myLyaer);
                    },1500);
                });
            });
            //删除订单
            $('.confirm-delete').on('click', function(){
                _this.orderId = $(this).attr('data-id');
                $(".tan-delete").show();
            });
            $('.delete-bill').on('click', function(){
                $('.tan').hide();
                _this.Submitdata = {
                    'order_id':_this.orderId,
                    'op':'delete'
                };
                var myLyaer = layer.open({type: 2 ,shadeClose:false});
                ajaxEve('post', server.myorder_operate,  _this.Submitdata, function (result) {
                    layer.close(myLyaer);
                    if (result.status == 200) {
                        layer.open({
                            content: result.msg,skin: 'msg',time: 2
                        });
                        setTimeout(function(){
                            // _this.lastHref = document.referrer;
                                window.location.replace('myorder.html');
                        },1500);
                        return;
                    }
                }, function (result) {
                    setTimeout(function(){
                        layer.close(myLyaer);
                    },1500);
                });
            });
            $('.confirm-pay-quxiao').click(function(){
                window.location.href = './goodsbuy.html?id='+$(this).attr('data_href');
                window.sessionStorage.shopmailbuytype = '2';
            });
            return;
        }
    }, function (result) {
    });
};


//swiper初始化
networking.prototype.swiperInit = function(){
    var mySwiper = new Swiper ('.swiper-container', {
        direction: 'horizontal',
        loop: true,
        autoplay:2000,
        autoplayDisableOnInteraction : false,
        // 如果需要分页器
        pagination: '.swiper-pagination',
    });
    return mySwiper;
};

// 手机正则
networking.prototype.checkMobile = function(sMobile) {
    var phone = $.trim(sMobile);
    var reg = /^1\d{10}$/;
    return reg.test(phone); 
};
//身份证号验证
networking.prototype.isCardNo = function(card) {
    // 身份证号码为15位或者18位，15位时全为数字，18位前17位为数字，最后一位是校验位，可能为数字或字符X
    var idNumber = $.trim(card);
    var reg =/(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;
    return reg.test(idNumber);
};

//中文姓名验证
networking.prototype.isRename = function(realname) {
    //姓名格式为2-4为纯中文
    var name = $.trim(realname);
    var reg =/^([\u4e00-\u9fa5]){2,10}$/;
    return reg.test(name);
};

//不出现中文
networking.prototype.noChinese = function(sitename) {
    //只能为字母或数字
    var site = $.trim(sitename);
    var reg = /^[^\u4e00-\u9fa5]+$/;
    return reg.test(site);
};
//四位小数
networking.prototype.Fourplace = function(sitename) {
    var site = $.trim(sitename);
    if(!isNaN(sitename)){
        return true;
    };
    return false;
};
//金额验证
networking.prototype.money = function(sitename) {
    var site = $.trim(sitename);
    var isNum=/^(([1-9][0-9]*)|(([0]\.\d{1,2}|[1-9][0-9]*\.\d{1,2})))$/;
    return isNum.test(site);
};

networking.prototype.UserLogin = function(sMobile) { //用户名验证
    var phone = $.trim(sMobile);
    var reg1 = /.*[\u4e00-\u9fa5]+.*$/;
    var reg2 = /\d+/;
    var pattern = new RegExp("[`~!@#$^&*()=|{}':;',\\[\\].<>《》/?~！@#￥……&*（）——|{}【】‘；：”“'。，、？]");
    var pattern2 = /[a-zA-Z]/;
    return reg1.test(phone)&&reg2.test(phone)&&!pattern.test(phone)&&!pattern2.test(phone); 
};
networking.prototype.Password = function(val) {//密码格式
    var reg = /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{8,12}$/
    return reg.test(val);
};
networking.prototype.Numberonly = function(val){ //数字验证
    var reg = /^[0-9]*$/;
    return reg.test(val);
};



function countdown(){
	var downnum = 60;
	var VerificationCode = document.getElementsByClassName('Verification')[0];
	countdowntime = window.setInterval(function(){
		downnum --;
		VerificationCode.innerHTML = downnum + "秒再次获取";
		if(downnum < 0){
			VerificationCode.innerHTML = "再次获取";
			clearInterval(countdowntime);
			countdowntype = true;
		}
	},1000)
}

function passwordStatus(domdata,inputtype){//密码状态是否显示
	if(domdata.className == 'type hide'){
		domdata.className = "type Eye";
		inputtype.type = "text";
	}else {
		domdata.className = "type hide";
		inputtype.type = "password";
	}
};

function agreementtypexian(num,domdata){//用户协议
	if(num.agreementtype){
		domdata.className = "agreementicon Unselectedsquare";
        num.agreementtype = false;
	}else {
		domdata.className = "agreementicon Squarecheck";
        num.agreementtype = true;
	};
};
function layerOpen1(text){
	layer.open({
	    content: text,skin: 'msg',time: 2 , type:'0'
	});
};
function layerOpen2(){
	layer.open({
	    content: '',skin: 'msg',time: 2 , type:'2'
	});
};